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

Use Oxipng instead of Optipng #279

Open
Rainboom-Dash opened this issue Sep 4, 2023 · 1 comment
Open

Use Oxipng instead of Optipng #279

Rainboom-Dash opened this issue Sep 4, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@Rainboom-Dash
Copy link

Rainboom-Dash commented Sep 4, 2023

Main reason: lower file sizes while not being longer to compress than default optipng compression

Based on my testing, oxipng usually beats optipng... it can lose in some cases by a few percent (simplistic rasterized images of a vector is an example where it can lose) but overall seems to beat it by a few percent while not taking longer

Even with -o2 and -t1, it seems to overall be more efficient than optipng while also being much faster while keeping it single-threaded

I just did a small test (26 images to be exact) of some recent images under "dashabetes" tag and made sure they were all compressed with default optipng (a lot weren't as I know the compression level was temporarily decreased recently and then turned back up)
default optipng: 44.2MiB
8.0 release oxipng -o2: 41MiB
5 images were more efficient with optipng than oxipng but they didn't contribute much difference to the file size
most of the time optipng wins, the image was simplistic anyway so the file size was not big

@Rainboom-Dash Rainboom-Dash added the enhancement New feature or request label Sep 4, 2023
@Rainboom-Dash
Copy link
Author

Apparently, Derpibooru still uses -o1 for optipng! I was wrong there
It works well for the most part.. but there are instances like the last image in this test where it chooses a poor filter (optipng -o1 versus default [-o2] oxipng)
https://cdn.discordapp.com/attachments/730093648548462642/1166281607557169183/SPOILER_comparison.png
oxipng does a quick evaluation of 4 filters by default which I believe reduces the chance of this happening

Also, optipng apparently compresses every image twice... for no reason... it makes sense for it to do this with more than 1 trial to cut down on memory.. but with only 1 trial tested, it doesn't really make sense.. so this is PART of the reason why it is so slow compared to oxipng
But it's also because oxipng is using libdeflate which is not only capable of much lower file sizes... but also much, much faster

Oxipng does use more memory, so that is something to consider

liamwhite added a commit that referenced this issue Jun 9, 2024
Remove long-obsolete owner options scripts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant