aspose file tools
The moose likes Java in General and the fly likes Java Picture Scaling Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "Java Picture Scaling" Watch "Java Picture Scaling" New topic
Author

Java Picture Scaling

Ryan Bailey
Ranch Hand

Joined: Feb 26, 2002
Posts: 134
Does anyone know if there is an API out there to scale pictures.
Essentially I am allowing users to upload pictures which I'm storing on a database. If the picture the user is trying to store is not of proper size, i want programatically scale the picture to reduce the image size.
Thanks,
Ryan


SCJP 1.4, SCWCD
Java: The power, elegance, and simplicity of a hand grenade
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
Hi Ryan,
You want the java.awt.Image class. When you have an image you can scale it like this:

The hints field suggests the manner in which the image will be scaled. You can look in API docs for the hints and their meaning.
Hope this helps,
Michael Morris


Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
 
IntelliJ Java IDE
 
subject: Java Picture Scaling
 
Threads others viewed
Where are the pictures of my jsf page?!
Need to capture Eye Lens of a Human picture
Swing Graphics and JPanel setPrefrerredSize
image scaling error
MMAPI - how to adjust size of image in .getsnapshot
IntelliJ Java IDE