Generating jpeg progressive with ImageIO

30/07/2009    





Here's an example of how to generate progressive Jpeg with the ImageIO api:


ImageWriteParam writer.getDefaultWriteParam param = ();

param.setCompressionMode (ImageWriteParam.MODE_EXPLICIT);

param.setCompressionQuality (quality);

param.setProgressiveMode (ImageWriteParam.MODE_DEFAULT);

ImageWriter writer = (ImageWriter) ImageIO.getImageWritersByFormatName ('JPEG'). Next ();
writer.setOutput (ImageIO.createImageOutputStream (out));
writer.write (null, new IIOImage (image, null, null), param);


For those who do not know what a progressive jpeg, read a more technical explanation and accurate:

http://www.faqs.org/faqs/jpeg-faq/part1/section-11.html

To laymen, we can summarize:

'Is that' efeitinho'?|?| that causes the image is loaded every initially 'unfocused' and then you will gain clarity, "this is a rough explanation well, actually there is no effect, what happens is the browser receives information differently when it encounters a progressive jpeg to load, this jpeg to be written in a different way, there's nothing Javascript or css can do (perhaps with swf animated gif ... ..) but alas already lost the focus (jpeg).

Hugs

Topo     Link para este post     Comentários

Redação Ige. ( redacao@informativogeral.com.br )





 
Lomadee, uma nova espécie na web. A maior plataforma de afiliados da América Latina




VOTE NO AMARELINHO PARA O TOP BLOG 2010
     


próximas >>