Twinside / Juicy.Pixels

Haskell library to load & save pictures

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Direct reading of paletted images

tilk opened this issue · comments

The JuicyPixels library does not currently allow for direct reading of paletted images. Instead, they are automatically converted to RGB. The palette can be recovered with palettize, but with a performance hit and reordering the colors in the palette - which is unacceptable in some applications.

My proposal: extend the DynamicImage type with a paletted image type (a pair of a Pixel8 image and a Palette) and add relevant conversions. It may be needed to add a new RGBA palette type to accomodate paletted PNG with transparency.

The change could potentially break some programs using the library. If that is not acceptable, another possibility is to keep decodeImage returning RGB images, and add separate functions for decoding paletted images.