invoke-ai/InvokeAI

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

开放

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

 (10 条评论) (2 个反应) (0 位负责人)TypeScript (2,164 个派生)batch import
Inactive Issueenhancementgood first issue

仓库指标

星标
 (20,358 个星标)
PR 合并指标
 (PR 指标待抓取)

描述

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.

贡献者指南