This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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 Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "resizing image...." Watch "resizing image...." New topic
Author

resizing image....

Jigar Naik
Ranch Hand

Joined: Dec 12, 2006
Posts: 753
Hi,

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: 14074
    
  16

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
 
Don't get me started about those stupid light bulbs.
 
subject: resizing image....
 
Similar Threads
Accepting File Uploads to Server
Storibg binary data in blog + mysql
jakarta fileupload - suggestions to improve my code
Storing image in blog fileld of mysql database
Displaying image which is outside my web application