Support writing QOI images by thisismypassport · Pull Request #9007 · python-pillow/Pillow

Adds support for writing .qoi files.

In more details:

  • I followed the reference implementation pretty closely.
  • I verified that the test files generated are the same as the reference implementation generates.
  • I also followed the coding guidelines observed from the .qoi reading implementation pretty closely, and avoided touching it.

Unrelated note - the .qoi reading implementation incorrectly adds (0, 0, 0, 255) to _previously_seen_pixels at the start.
It should only be set on _previous_pixel.
However, I think this is benign since (0,0,0,255) has a different hash from (0,0,0,0) and a valid encoder won't encode (0,0,0,0) using non-0 hash values.