Re: Able to disable JOGL's PNG decoder?
Posted by
hernan on
URL: https://forum.jogamp.org/Able-to-disable-JOGL-s-PNG-decoder-tp4027701p4027739.html
"It appears that the alpha channel is rendered instead of the indexed color channel."
There is no "alpha channel" in a PNG indexed image. What happens here is that the palette is being ignored by JOGL, and the pixels values (indexes into the palette) are interpreted as grayscale values - or, equivalently, a grayscale palette is being assumed. The current result (screenshot in the issue attachment) can be reproduced by this PNGJ-only code:
public static void main(String[] args) {
indexedToG("C:/temp/indexed.png","C:/temp/indexed2.png");
}
private static void indexedToG(String src, String tgt) {
PngReader pngr =FileHelper.createPngReader(new File(src));
ImageInfo imi1 = pngr.imgInfo;
ImageInfo imi2 = new ImageInfo(imi1.cols,imi1.rows,8,false,true,false); // grayscale
PngWriter pngw = FileHelper.createPngWriter(new File(tgt),imi2,false);
for(int i=0;i<imi1.rows;i++) {
ImageLine line = pngr.readRow(i);
pngw.writeRow(line,i);
}
pngr.end();
pngw.end();
}
Hernan
https://code.google.com/p/pngj/
-- Hernán J. González