[OpenJDK 2D-Dev] JPEGImageEncoder inquiry...

Brian Burkhalter Brian.Burkhalter at Sun.COM
Wed Aug 19 16:13:46 UTC 2009


http://java.sun.com/javase/6/docs/api/javax/imageio/ImageIO.html#write(java.awt.image.RenderedImage,%20java.lang.String,%20java.io.File)

On Aug 18, 2009, at 8:28 PM, JIA Pei wrote:

>
> Hi, Dear Brian Burkhalter:
>
> Thank you so much for you kind reply.
>
> May I ask for a simple code from you to save an ".jpg“ format image.
>
> My code is something like:
>
>
>         BufferedImage bImage = doRender(width, height);
>
>         RenderedImage fImage = JAI.create("format", bImage,   
> DataBuffer.TYPE_BYTE);
>
>         JAI.create("filestore", fImage, filename + ".jpg", "jpeg",  
> null);
>
>
> However, Eclipse notified that the 2nd line is deprecated and there  
> is a cross line on "create" in the 2nd line (in red).
>
> What's more, even if the 2nd line is deprecated, I'm still able to  
> save an image in .jpg format. However, what has been saved can not  
> be previewed by many software, including "Windows Picture and Fax  
> Viewer", "Image Magic Display", "Windows Paint", etc. I can only  
> preview the image by using "QuickTime Picture Viewer".  That's not  
> actually what I expected and I think the saved image should be able  
> to be previewed by all the popular softwares.
>
> So, can you please help to give me your code when you tried to  
> save .jpg files? Thanks in advance.
>
>
> Best Regards
> JIA Pei
>
>
> On Tue, Aug 18, 2009 at 8:52 PM, Brian Burkhalter <Brian.Burkhalter at sun.com 
> > wrote:
> Decimation subsampling may be specified for both readers and  
> writers, using a movable subsampling grid.
>
> http://java.sun.com/javase/6/docs/api/javax/imageio/IIOParam.html
>
> Specifies a decimation subsampling to apply on I/O.
>
> http://java.sun.com/javase/6/docs/api/javax/imageio/IIOParam.html#setSourceSubsampling(int,%20int,%20int,%20int)
>
>
> On Aug 18, 2009, at 12:32 PM, Adam Augusta wrote:
>
> ImageIO has a quantization level, but if you want to use the other
> features of the Sun encoder like horizontal/vertical subsampling, for
> example, I think you're out of luck.  Sorry.
>
> On Tue, Aug 18, 2009 at 2:49 PM, JIA Pei<jp4work at gmail.com> wrote:
>
> Hi, Dear All:
>
> I happened to notice there is some differences between SUN JDK and  
> OpenJDK.
> In fact, I'm using "JPEGImageEncoder", which seems to be supported  
> well by
> SUN JDK but not by OpenJDK. Especially, the function  
> "setJPEGEncodeParam".
>
> So, I'm wondering if JAI+JAI ImageIO can replace the above  
> JPEGImageEncoder
> ? My purpose is just for .jpeg image saving.
>
>
> Best Regards
> JIA Pei
>
> --
> Welcome to Vision Open
> http://www.visionopen.com
>
>
> Brian
>
> >^..^<    >^..^<
>
>
>
>
> -- 
> Welcome to Vision Open
> http://www.visionopen.com

Brian

 >^..^<    >^..^<

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/2d-dev/attachments/20090819/4ac4b456/attachment.html>


More information about the 2d-dev mailing list