Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support of QOI images #3726

Open
caffeine-mgn opened this issue Dec 29, 2021 · 8 comments · May be fixed by godotengine/godot#80768 or godotengine/godot#91263
Open

Add support of QOI images #3726

caffeine-mgn opened this issue Dec 29, 2021 · 8 comments · May be fixed by godotengine/godot#80768 or godotengine/godot#91263

Comments

@caffeine-mgn
Copy link

Describe the project you are working on

Making some game

Describe the problem or limitation you are having in your project

I want to use QOI images for fast loading. More info this: https://github.com/phoboslab/qoi

Describe the feature / enhancement and how it helps to overcome the problem or limitation

Faster image loading

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

N/A

If this enhancement will not be used often, can it be worked around with a few lines of script?

nop

Is there a reason why this should be core and not an add-on in the asset library?

Yep, image decoding looks like a part of core

@Calinou
Copy link
Member

Calinou commented Dec 29, 2021

I want to use QOI images for fast loading. More info this: phoboslab/qoi

Have you profiled image loading to be a significant bottleneck in your project? Lossless WebP encoding was added to Godot 3.4, and it already loads faster than PNG did.
Remember that in a 3D game, you will be using VRAM-compressed textures for most objects. This means having a faster lossless format available will not help your game load faster.

I feel adding image codecs for the sake of adding image codecs is something we should avoid doing in core. Doing so will increase the binary size of editor and export templates for no good reason. Instead, it would be better to expose the necessary API to make supporting more image formats possible with an extension.

This may change if QOI ends up gaining significant adoption in popular applications, but I'd be surprised given its relatively niche use cases. History has shown that dethroning JPEG and PNG is a difficult task 🙂

@fire
Copy link
Member

fire commented Jan 5, 2022

See also #2461 for the avif format.

@IntangibleMatter
Copy link

I think that adding QOI would be a good thing. It's pretty small, fast, and is getting less and less niche. I know that as soon as I can I'm moving away from PNG. If nothing else, QOI seems "cooler" to devs and Godot having native support would be a good thing to do for the engine in the long term. Be a leader.

Besides, qoi.h is only like, 600 lines long :p

@Calinou
Copy link
Member

Calinou commented Apr 6, 2022

If nothing else, QOI seems "cooler" to devs and Godot having native support would be a good thing to do for the engine in the long term. Be a leader.

I'm afraid this is not how features are chosen for inclusion in Godot. See Best practices for engine contributors for more information.

@DeeJayLSP
Copy link

DeeJayLSP commented Apr 30, 2024

After finding out that GameMaker has an implementation of QOI (combined with BZip2) as the default image compression I decided to run a few tests.

Since Godot compresses images using Lossless WebP by default, the comparison would be against it at max compression. While QOI undoubtedly encodes much faster (and likely has a close decoding speed), it loses almost every time in compression ratio, even to PNG.

The situation changes if you include BZip2 compression (at best setting). While it now always beats PNG (oxipng -o 6), it sometimes beats Lossless WebP by being 10-23% smaller, sometimes loses by being 10-38% bigger. Note that losing is most of the cases.

Not sure how this affects decoding speed. I believe the variation in size has something to do about color variation in the image.

I also tried to apply Brotli and Zstandard to the QOI files, both at the best compression setting. In terms of compression, Brotli was the best, beating BZip2 most of the time. Zstandard didn't get a chance.

This is just something I did out of curiosity and wanted to share since it's in the context of this proposal. Compressed QOI doesn't seem to compete with Lossless WebP to me.

@fire
Copy link
Member

fire commented May 1, 2024

Since we already use zstd, maybe there's a setting of zstd with QOI that makes it enter the competition.

@Calinou
Copy link
Member

Calinou commented May 1, 2024

Compressed QOI is an interesting idea, but it makes the file format no longer standard. This means ffmpeg can't accept it as input for Movie Maker usage, for instance.

@DeeJayLSP
Copy link

My consideration was Compressed QOI as a potential alternative to Lossless WebP compression. But as I said, WebP still wins.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants