InteractiveMind
asked on
Resize Image
Hi..
I'm looking for a simple solution, to resize an image.. perferably some method with this effect:
Image oldImage = new ImageImage("..").getImage( );
Image newImage = resizeImage( oldImage, 800, 600 ); // 800px wide, 600px high
Anyone? I'm guessing I need to use the AffineTransform.scale(..) for this; but I don't know what sort of argument I would need to pass...
For example:
AffineTransform tx = new AffineTransform();
tx.scale(scalex, scaley);
What would the scalex and scaley need to be, in order to scale it down, from 1024x768 to 800x600 (for example)..
Would it be something like this:
AffineTransform tx = new AffineTransform();
tx.scale(0.78125, 0.78125);
??
Cheers.
>> IM
I'm looking for a simple solution, to resize an image.. perferably some method with this effect:
Image oldImage = new ImageImage("..").getImage(
Image newImage = resizeImage( oldImage, 800, 600 ); // 800px wide, 600px high
Anyone? I'm guessing I need to use the AffineTransform.scale(..) for this; but I don't know what sort of argument I would need to pass...
For example:
AffineTransform tx = new AffineTransform();
tx.scale(scalex, scaley);
What would the scalex and scaley need to be, in order to scale it down, from 1024x768 to 800x600 (for example)..
Would it be something like this:
AffineTransform tx = new AffineTransform();
tx.scale(0.78125, 0.78125);
??
Cheers.
>> IM
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
scalex = 800 * 1024
scaley = 600 * 768
scaley = 600 * 768
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
heres an example showing how to create thumbnails:
http://developer.java.sun.com/developer/TechTips/1999/tt1021.html
http://developer.java.sun.com/developer/TechTips/1999/tt1021.html
Which is
>> tx.scale(0.78125, 0.78125);
indeed :°)
>> tx.scale(0.78125, 0.78125);
indeed :°)
you can also use:
Image scaled = image.getScaledInstance(wi dth, height ,Image.SCALE_FAST);
Image scaled = image.getScaledInstance(wi
ASKER
Thank you. :)
Thanks
no worries :)
scaley - the factor by which coordinates are scaled along the Y axis direction