treeform/pixie

QOI decoding does not convert between sRGB and Linear

de-odex opened this issue · 4 comments

Hello, this is less a bug than an observation, but when I was reading the code for QOI decoding I noticed that the colourspace is never checked in conversion to an Image.
I was wondering if there was a mistake here as that would mean Image could either have gamma-encoded sRGB values or linear sRGB values, whilst not also storing which it would be.
Furthermore, perhaps more clarification as to what ColorRGBX (and friends RGB RGBA) stores in terms of colourspace is needed.

@ehmry could you look into this? You wrote the entire encoding/decoding stack. It looks like there is a flag in the spec for linear and sRGB, pixie should support reading sRGB and should always write linear.

Pixie does not support sRGB.
ColorRGBX is just premultiplied alpha RGBA (its not a color space).

ehmry commented

I'll see what I­ can do.

ehmry commented

All of the QOI images I can find are in sRGB (https://qoiformat.org/qoi_test_images.zip) and when decoding a QOI and encoding to PNG the grays come out the same. I'm not sure what is going on here.

I only noticed this from reading the specification; I do not know if it is used in practice but it is nonetheless in the spec... I don't know why it is in the spec but if it doesn't matter then it's probably fine to drop this for now