dimanche 1 mars 2015

Resize image without loss of information

I was trying to do really the same functionality of resizing images like in MS Word.


I want to resize BufferedImage but I’m losing some information during process of resizing.


I tried to implement two approaches, but both produced same result.


Before any resizing:


enter image description here


Picture after few resize actions in my application:


enter image description here


First approach:



image = Thumbnails.of(image).size(w,h).asBufferedImage();


Second approach:



image = toBufferedImage(image.getScaledInstance(w, h, Image.SCALE_SMOOTH));


image is instance of BufferedImage, w is new width of image and h is new hight of image


Any idea, what I’m doing wrong?


Aucun commentaire:

Enregistrer un commentaire