A Python wrapper around the QOI (Quite OK Image format) reference implementation by phoboslab. Supports encoding and decoding QOI images from numpy arrays or raw bytes. Current version 0.7.2 (stable), release cadence: sporadic.
pip install qoiVerified import paths — ran on the pinned version, not inferred.
Encode and decode a QOI image using numpy arrays.
Use qoi.encode(img) to get bytes, qoi.decode(data) to decode bytes.
Update to use qoi.write() and qoi.read() directly (or qoi.encode()/decode() for bytes).
Ensure image is uint8 and 3 or 4 channels: img = img.astype(np.uint8) and if 2D reshape to (h,w,1) not supported.
Use qoi.encode(img) to get bytes, then write to file, or use qoi.write(filepath, img) (if using v0.7+).
Use module-level functions: qoi.write() or qoi.read().
Verify the file is indeed a QOI image. Check first 4 bytes are b'qoif'.
Cast to uint8: img = img.astype(np.uint8).
Convert to RGB by duplicating channel or use a format that supports single channel.