Adjust the quality of JPEG encoding when saving images in JDK 1.4.2

  • Follow


It's easy to save a BufferedImage the following way :

BufferedImage image = ...
File file = new File("picture.jpg");
ImageIO.write(image, "jpg", file);

But how do you adjust the quality of the JPEG encoding ? (in JDK 1.4.2)
0
Reply sunrise1647 (4) 7/2/2003 2:11:13 PM

MCP:

[...]

>But how do you adjust the quality of the JPEG encoding ? (in JDK 1.4.2)

Use a (JPEG)ImageWriteParam object and call its setCompressionQuality
method. Here's code:
<http://javaalmanac.com/egs/javax.imageio/JpegWrite.html>.

Regards,
Marco
-- 
Please reply in the newsgroup, not by email!
Java programming tips: http://jiu.sourceforge.net/javatips.html
Other Java pages: http://www.geocities.com/marcoschmidt.geo/java.html
0
Reply marcoschmidt (215) 7/3/2003 8:33:54 AM


1 Replies
33 Views

(page loaded in 0.077 seconds)

Similiar Articles:





7/4/2012 9:16:37 PM


Reply: