pngquant icon indicating copy to clipboard operation
pngquant copied to clipboard

Possibility of adding liq_image_create_argb()

Open Bill-Stewart-1 opened this issue 2 years ago • 1 comments

It is currently difficult to use libimagequant to work with Cairo or X buffers because they are ARGB and libimagequant only has data import for RGBA pixels. It would be very helpful to have an import option that works on the buffers without having to rebuild them pixel by pixel first. The export function is less of a concern because the output is typically right to a file, not back to the original buffer.

Bill-Stewart-1 avatar Jan 12 '22 20:01 Bill-Stewart-1

I suggest using byte-swapping callback for this:

https://pngquant.org/lib/#liq_image_create_custom

Any function I can add is going to do precisely this, or copy and swap pixels, because the rest of the codebase uses rgba. To have an argb-native version I'd have to make huge copy'n'paste and double the code size.

kornelski avatar Jan 12 '22 22:01 kornelski