Resizing a existing jpeg-file
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Michael_Decker
Posted On:   Monday, November 25, 2002 04:28 AM

Hi!

is there a way to read jpeg-file for example 2000x3000 pixels and write a new jpeg-file with 200x300 pixels?

Is there any where a ready solution for this problem?

I thank you!

Mike

Re: Resizing a existing jpeg-file

Posted By:   Christopher_Schultz  
Posted On:   Monday, November 25, 2002 12:39 PM

Sizing an image and reading/writing JPEG files are two different things. Use of JPEG codecs is covered in the FAQs.



In order to resize an image, simple do this:




Image source = ...;

BufferedImage target = new BufferedImage(200, 300, BufferedImage.TYPE_INT_ARGB); // What type?

Graphics g = target.getGraphics();
g.drawImage(source, 0, 0, 200, 300, (ImageObserver)null);


Good luck,
-chris
About | Sitemap | Contact