PNG native acceleration
I am trying native acceleration using JAI and/or Image I/O tools.
I am using the following code:
ImageIO.write(image, "png", outputStream);
So, i installed JAI I/O Tools to my JRE, it works like a charm with native acceleration without any code modification.
Now, I want to start using JAI, so I replaced the code with:
JAI.create("encode", image, outputStream, "png");
So, this time I installed JAI to my JRE, it created the PNG image but without native acceleration. I started to investigate further ... so i tried,
JAI.create("encode", image, outputStream, "jpeg");
JAI.create("encode", image, outputStream, "bmp");
Both the jpeg/bmp formats worked like a charm and with native acceleration.
Does anybody know if "png" native acceleration is supported in JAI (documents says supported)? Or do I have to do something special in order to work with "png" format? Either by changing the code or installing something else?
Thanks!
[1001 byte] By [
shahkun3a] at [2007-10-3 7:13:35]

Thanks for the information regarding "ImageWrite"! So, following is what I am doing now and it's working.
ParameterBlock block = new ParameterBlock();
block.add(outputStream);
block.add(IMAGE_TYPE);
block.add(new Boolean(true));
block.add(new Boolean(true));
block.add(new Boolean(true));
block.add(new Boolean(false));
block.add(null);
block.add(null);
block.add(null);
block.add(null);
block.add(null);
block.add(null);
block.add(null);
block.add(null);
block.addSource(image);
JAI.create("ImageWrite", block);
If you are back on this forum, can you please write some tips to improve the following code!
Thanks again!
Sorry if I confused you. The above code works.
I was looking for suggestions like you made one, use ParameterBlockJAI. Code looks pretty now!
ParameterBlockJAI block = new ParameterBlockJAI("ImageWrite");
block.setParameter("Output", outputStream);
block.setParameter("Format", IMAGE_TYPE);
block.addSource(image);
JAI.create("ImageWrite", block);
Thanks!