aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes How to resize image Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "How to resize image" Watch "How to resize image" New topic
Author

How to resize image

rose deng
Ranch Hand

Joined: Dec 29, 2000
Posts: 78
Hi.
I want to resize image, say,the original size of the image is 800*600, i want to reduce it to 80% of original size.
How to.
Thanks for your kind help in advance.
Angela Lamb
Ranch Hand

Joined: Feb 22, 2001
Posts: 156
Here is a link to the docs for the Image method getScaledInstance:
http://java.sun.com/j2se/1.3/docs/api/java/awt/Image.html#getScaledInstance(int,int,in t)
It takes a new height and width for parameters, not percentage, but you should be able to calculate those yourself.
[This message has been edited by Angela Ann (edited March 29, 2001).]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How to resize image