Traneptora / jxlatte

Java JPEG XL decoder
MIT License
41 stars 6 forks source link

Option to decode jxl pixel data directly into a ByteBuffer. #31

Closed Waterpicker closed 1 month ago

Waterpicker commented 3 months ago

A simple option to directly have the pixel data by itself as a ByteBuffer. Something you can directly upload in opengl. I don't mind taking a crack

Traneptora commented 3 months ago

Why not just do ((DataBufferFloat)JXLImage.asBufferedImage().getData().getDataBuffer()).getBankData()? OpenGL supports float as a data type.

AlexanderSchuetz97 commented 1 month ago

@Traneptora I would also appreciate a method that just gives me a RGB or ARGB buffer either as int or bytes. Its just more useful for various image processing things that are downstream. In op's case opengl. (I do belive that opengl supports float color models but stuff that I need/have doesn't)

It Doesn't have to be a nio Byte/IntBuffer, for me a BufferedImage with one of those types: INT_ARGB/INT_RGB/TYPE_4BYTE_ABGR/TYPE_3BYTE_BGR would be good.

I am aware that I can convert your float BufferedImage to such a Buffered Image either via AWT Graphics or by using the color model directly. But If its possible to do it "faster" on your end then you could perhaps directly create such a image skipping the "float" step? If its not possible then I will just stick to converting to the desired format once I do actually need JXL in my application.

Traneptora commented 1 month ago

This would be somewhat difficult as JXLatte decodes to float internally. There's no "float step" to skip.

AlexanderSchuetz97 commented 1 month ago

Understandable, in this case i would recommend you close this.