<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; "><a href="http://java.sun.com/javase/6/docs/api/javax/imageio/ImageIO.html#write(java.awt.image.RenderedImage,%20java.lang.String,%20java.io.File)">http://java.sun.com/javase/6/docs/api/javax/imageio/ImageIO.html#write(java.awt.image.RenderedImage,%20java.lang.String,%20java.io.File)</a></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 12px/normal Helvetica; "><br></div><div><div>On Aug 18, 2009, at 8:28 PM, JIA Pei wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><br>Hi, Dear Brian Burkhalter:<br><br>Thank you so much for you kind reply.<br><br>May I ask for a simple code from you to save an ".jpg“ format image.<br><br>My code is something like:<br><br><br> BufferedImage bImage = doRender(width, height);<br> <br> RenderedImage fImage = JAI.<b><span style="color: rgb(255, 0, 0);">create</span></b>("format", bImage, DataBuffer.TYPE_BYTE);<br><br> JAI.create("filestore", fImage, filename + ".jpg", "jpeg", null);<br> <br><br>However, Eclipse notified that the 2nd line is deprecated and there is a cross line on "create" in the 2nd line (in red).<br><br>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. <br> <br>So, can you please help to give me your code when you tried to save .jpg files? Thanks in advance.<br><br><br>Best Regards<br>JIA Pei<br><br><br><div class="gmail_quote">On Tue, Aug 18, 2009 at 8:52 PM, Brian Burkhalter <span dir="ltr"><<a href="mailto:Brian.Burkhalter@sun.com">Brian.Burkhalter@sun.com</a>></span> wrote:<br> <blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Decimation subsampling may be specified for both readers and writers, using a movable subsampling grid.<br> <br> <a href="http://java.sun.com/javase/6/docs/api/javax/imageio/IIOParam.html" target="_blank">http://java.sun.com/javase/6/docs/api/javax/imageio/IIOParam.html</a><br> <br> Specifies a decimation subsampling to apply on I/O.<br> <br> <a href="http://java.sun.com/javase/6/docs/api/javax/imageio/IIOParam.html#setSourceSubsampling%28int,%20int,%20int,%20int%29" target="_blank">http://java.sun.com/javase/6/docs/api/javax/imageio/IIOParam.html#setSourceSubsampling(int,%20int,%20int,%20int)</a><div> <div></div><div class="h5"><br> <br> On Aug 18, 2009, at 12:32 PM, Adam Augusta wrote:<br> <br> <blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> ImageIO has a quantization level, but if you want to use the other<br> features of the Sun encoder like horizontal/vertical subsampling, for<br> example, I think you're out of luck. Sorry.<br> <br> On Tue, Aug 18, 2009 at 2:49 PM, JIA Pei<<a href="mailto:jp4work@gmail.com" target="_blank">jp4work@gmail.com</a>> wrote:<br> <blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> <br> Hi, Dear All:<br> <br> I happened to notice there is some differences between SUN JDK and OpenJDK.<br> In fact, I'm using "JPEGImageEncoder", which seems to be supported well by<br> SUN JDK but not by OpenJDK. Especially, the function "setJPEGEncodeParam".<br> <br> So, I'm wondering if JAI+JAI ImageIO can replace the above JPEGImageEncoder<br> ? My purpose is just for .jpeg image saving.<br> <br> <br> Best Regards<br> JIA Pei<br> <br> --<br> Welcome to Vision Open<br> <a href="http://www.visionopen.com" target="_blank">http://www.visionopen.com</a><br> <br> </blockquote></blockquote> <br></div></div> Brian<br> <br> >^..^< >^..^<<br> <br> </blockquote></div><br><br clear="all"><br>-- <br>Welcome to Vision Open<br><a href="http://www.visionopen.com">http://www.visionopen.com</a><br></blockquote></div><br><div> <span class="Apple-style-span" style="font-size: 12px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">Brian</span></div><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br></div><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">>^..^< >^..^<</span></div></span></div></span></div></span></div></span> </div><br></body></html>