phoboslab / qoi

The “Quite OK Image Format” for fast, lossless image compression
MIT License
6.83k stars 328 forks source link

Add Lua LIL #292

Closed finnurthorisson closed 7 months ago

finnurthorisson commented 7 months ago

Really elegant and efficient little format. It was even very fun to implement

finnurthorisson commented 7 months ago

BTW, the spec does not specifically allow it but when encoding I discard RGB values when alpha is 0. Is that typical for implementations? It looks like yours does not

phoboslab commented 7 months ago

Very neat library!

I discard RGB values when alpha is 0.

Some games may want to store a specular map or other information in the alpha channel and use RGB for the diffuse color. Here, discarding the RGB values would lead to undesired results. Also QOI should be lossless, so discarding information (no matter if visible or not) would break this promise. So I would advise against it, or at least clearly call this behavior out in the readme.