invoke-ai/InvokeAI

[enhancement]: add image format with better compression (webp, avif, jxl, etc)

Open

#2704 aperta il 18 feb 2023

Vedi su GitHub
 (10 commenti) (2 reazioni) (0 assegnatari)TypeScript (2164 fork)batch import
Inactive Issueenhancementgood first issue

Metriche repository

Star
 (20.358 star)
Metriche merge PR
 (Merge medio 39g 7h) (39 PR mergiate in 30 g)

Descrizione

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.

Guida contributor