Closed Ali-RS closed 1 year ago
I'm not going to debug a mass of your own code for you.
Can you tell me how I can check if the BufferedImage returned by JXLImage.asBufferedImage()
is valid? I wonder if the alpha values stored in the BufferedImage are corrupted.
I tried to write it into a png file using ImageIO (see https://github.com/thebombzen/jxlatte/issues/13) and compare the result but it did not work so I am not sure how else I can check this.
Edit: Note that both of the loaders work fine if the image is opaque. This only happens with transparent images.
The buffered image is always valid. Whether or not ImageIO's PNG writer accepts it is a different story.
I have created two jxl loaders for a game engine, first one loads the image from raster (
JXLImage.getRaster()
), and the second one loads from BufferedImage (JXLImage.asBufferedImage()
).The result looks correct when loading from Raster (the first one) but it looks wrong when loading from BufferedImage (the second one). Seems a transparency issue.
This is how the result looks from the first loader (It is correct):
and here is the result from the second loader (It is incorrect):
This is the code for the first loader (using raster):
this is the code for the second loader (using BufferedImage):
I do not know what am I doing wrong in the second loader, do you perhaps have a hint on what might be wrong?
Could be that the alpha value in the BufferedImage is stored in HDR form instead of RGB form?
Here is my sample jxl file