invoke-ai/InvokeAI

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

Open

#2,704 创建于 2023年2月18日

在 GitHub 查看
 (10 评论) (2 反应) (0 负责人)TypeScript (20,358 star) (2,164 fork)batch import
Inactive Issueenhancementgood first issue

描述

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.

贡献者指南