My shot at making a QOI encoder and decoder
https://qoiformat.org/qoi-specification.pdf
- Put images (PNG or JPEG) in a folder.
- Set that folder as
in_directory
intheloadToBytes.py
file. - Run
python3 loadToBytes.py
to encode the images into raw RGBA bytes. - In
encode.py
settoQoi("imgBits/kodim23","imgQoi/kodim23.qoi", debug=False)
to have whatever bytes file you want aswell as the name and location of the ouput QOI file. - Run
python3 encode.py
to encode the bytes into a QOI image. - You can also use
python3 decode.py
to decode the QOI image which will save an immage inimgRevQoi/
with the decoded png.
Currently, you will notice the tests dont pass even though the images are identical. This is because my encoder allways encodes as RGBA as I didnt find a clean way of figuring out if a PNG has 3 or 4 channels. This means the array comparrisons used to check if the encoded version are identical fails due to having 4 values instead of 3. This could be fixed later.