Re: JPEG quality loss
- From: "Andrew Thompson" <andrewthommo@xxxxxxxxx>
- Date: 17 Jul 2006 09:41:34 -0700
k0m0r wrote:
<http://java.sun.com/j2se/1.5.0/docs/api/javax/imageio/ImageWriter.html#write(javax.imageio.metadata.IIOMetadata,%20javax.imageio.IIOImage,%20javax.imageio.ImageWriteParam)>
..combined with..
<http://java.sun.com/j2se/1.5.0/docs/api/javax/imageio/ImageWriteParam.html#setCompressionQuality(float)>
..should do what you want.
java.lang.UnsupportedOperationException: Compression not supported
Which brings me back to the question, "did you RTFM?".
<sscce>
import javax.imageio.ImageWriteParam;
import javax.imageio.plugins.jpeg.JPEGImageWriteParam;
import java.util.Locale;
public class WriteImage {
public static void main(String[] args) {
Locale locale = new Locale("en");
ImageWriteParam iwp1 = new ImageWriteParam(locale);
System.out.println(iwp1.canWriteCompressed());
JPEGImageWriteParam iwp2 = new JPEGImageWriteParam(locale);
System.out.println(iwp2.canWriteCompressed());
}
}
</sscce>
Andrew T.
.
- References:
- Re: JPEG quality loss
- From: Andrew Thompson
- Re: JPEG quality loss
- Prev by Date: Re: JPEG quality loss
- Next by Date: Re: Tomcat 5.5: exploded WAR directory persists
- Previous by thread: Re: JPEG quality loss
- Next by thread: Security Manager HOWTO??
- Index(es):