How might I enlarge image in java without losing quality?

守給你的承諾、 提交于 2019-12-11 08:02:45

问题


I am working with images in Java. I have a set of images - let's say 600x800 pixels each. I resize them at 100x100 and I make some stuff on it. Now I would like to enlarge the image at the beginning size without losing my changing and pixel quality. Is this possible?


回答1:


No. This also isn't really a Java question. How would you do this with an image editor? If you resize twice (especially smaller than larger), you're going to lose quality.

Your best bet is to keep the native resolution, then use vector graphics to draw what you need - eliminating any unnecessary resizing. (I.E., calculate what you need to draw, taking into account the current size - without first resizing to 100x100.) This will also fix some issues you're also probably seeing regarding the aspect ratios - as when you would resize from 100x100 back to 600x800, whatever you added is going to appear "stretched" / wider.




回答2:


I would like to enlarge the image at the beginning size without losing my changing and pixel quality. Is this possible?

Yes, it's possible and very simple.

Here's how you do it: use your original.



来源:https://stackoverflow.com/questions/9281385/how-might-i-enlarge-image-in-java-without-losing-quality

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!