Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

resize jpeg images

0 views
Skip to first unread message

ghel...@my-deja.com

unread,
Jan 26, 2001, 3:11:48 AM1/26/01
to
Hi,

I need to resize jpeg images.

My problem is that the drawImage method doesn't
resize the image very well.

Is there a better way to resize an image, maybe
one that averages out the colour or pixels?

Cheers,

Götz


Sent via Deja.com
http://www.deja.com/

Dietmar Scheidl

unread,
Jan 26, 2001, 3:41:21 AM1/26/01
to
Hi,

I asume that you are using ImageIcon or anything else to load the JPG.

javax.swing.ImageIcon imageIcon = new javax.swing.ImageIcon("test.jpg");
java.awt.Image newImage = imageIcon.getImage().getScaledInstance( width,
height, java.awt.Image.SCALE_AREA_AVERAGING );

Possible Scaling hints are:
java.awt.Image.SCALE_SMOOTH
java.awt.Image.SCALE_AREA_AVERAGING
...

Just have a look at the API documentation and choose yourself.

Now you can use the resized image.

Didi

<ghel...@my-deja.com> schrieb im Newsbeitrag
news:94rbg2$5ei$1...@nnrp1.deja.com...

0 new messages