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
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: 751

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: 13875

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 7 API documentation
Scala Notes - My blog about Scala
I agree. Here's the link:
subject: resizing image....
Similar Threads
Storing image in blog fileld of mysql database
jakarta fileupload - suggestions to improve my code
Accepting File Uploads to Server
Storibg binary data in blog + mysql
Displaying image which is outside my web application