Description
We generate a lot of images. I would like them to be encoded more efficiently. I don't need the encoding to be lossless.
I often convert the images I've generated with InvokeAI to webp before sharing them, and it's common for them to come out at 10% of the size of the PNG, or less. That's not 10% smaller, that's 10% total, e.g. a 0.77 MB file to a 0.05 MB file.
Feature-wise, JPEG XL would be my first choice for an output format, as it has fewest constraints on size and plenty of options for bit depth and extra channels.
However, given that InvokeAI is a web-centric application, JPEG XL doesn't have the browser support to be viable anytime soon. webp or avif would be more practical in this regard.
Additional Context
Easy part: image data
Write webp from PIL or avif from pillow-avif-plugin.
Messy part: metadata
InvokeAI currently stores image metadata inside a PNG tEXt chunk. It is not immediately obvious how to apply that to other file formats.
IMHO we should switch to using XMP instead, as XMP works more or less the same way regardless of image format.
Activity