Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
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
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: 15084

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