File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes resizing image.... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "resizing image...." Watch "resizing image...." New topic

resizing image....

Jigar Naik
Ranch Hand

Joined: Dec 12, 2006
Posts: 761

In my web application when user upload image, I want resize that image and than want to store it on the disk,

which api should i use to resize imege.

Following is my code which store image on disk. (Always JPG image)

Jigar Naik

Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 15045

You can just use drawImage to draw the image on a different BufferedImage. With drawImage you can specify a height and width to draw the image at. See for example: Images - BufferedImage.

For more information on working with graphics in Java have a look at this: The Java Tutorial - 2D Graphics

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
I agree. Here's the link:
subject: resizing image....
jQuery in Action, 3rd edition