phoboslab / qoi

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

Add metadata to QOI file? #294

Closed dmikushin closed 9 months ago

dmikushin commented 9 months ago

Most of the alternative image formats provide an ability to attach textual information to the file, i.e. a metadata. Is it possible to extend the QOI format to add metadata support?

phoboslab commented 9 months ago

There's no standardized way to do this, but you could just append arbitrary data after the end of the qoi file. Decdors will still be able to read the file and will ignore the data at the end.

E.g.:

cat image.qoi metadata.json > image_with_metadata.qoi

In your software, reading the metadata (without decoding the image) requires a scan for the qoi end marker 0x0000000000000001. This byte sequence is guaranteed to not be present within the image data itself.