treeform / pixie

Full-featured 2d graphics library for Nim.
MIT License
743 stars 28 forks source link

QOI support #354

Closed ehmry closed 2 years ago

ehmry commented 2 years ago

https://qoiformat.org/


Not actually lossless when converting the test reference files. There is some sort of off-by-one shift during toPremultipliedAlpha and toStraightAlpha. I see alpha artifacts on the edges of testcard_rgba.png that are somehow missing from the Pixie roundtrip encoding.

treeform commented 2 years ago

The toPremultipliedAlpha <> toStraightAlpha are not lossless. We run into this problem as well. In the png decoder we have a "raw" Png type that is lossless though. You might create a Qoi type that is losses and do most tests wit that. Then have the Image to Qoi conversation that does do the premultiplied alpha is another layer.

ehmry commented 2 years ago

Done.

I don't understand the what the "sRBG with linear alpha" or "all channels linear" bit flag implies so I'm not doing anything with it.

guzba commented 2 years ago

I've not personally used the Quite OK image format, but I have heard of it and supporting it seems cool.

ehmry commented 2 years ago

Pushed a new version with a Qoi data type.

I was thinking we have enough image formats but after these NSO image parser exploits I can appreciate something that is designed to be simple.

treeform commented 2 years ago

Thank you for your PR! This is great.

If you want to add any other image formats let us know.

digitalcraftsman commented 2 years ago

This great addition may also be mentioned in the README