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

Optimize Image and Add to Additional Location (Ref: #596) #597

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Zallb
Copy link
Contributor

@Zallb Zallb commented Jan 23, 2025

This pull request optimizes the image initially included in PR #596 with Zopflipng. Additionally, replacing the old image that was previously missed in the ip2c.

Please review the changes and inform me of any other locations where the old flag might still be in use.

Zallb added 2 commits January 23, 2025 13:06
Optimized with Zopflipng
Optimized with Zopflipng
@Fernando-A-Rocha
Copy link
Contributor

This is not your fault, but ideally we shouldn't have duplicated flag images in the official resources. If we're keeping them, they should be centralized in 1 res.

@AlexTMjugador
Copy link
Member

AlexTMjugador commented Jan 23, 2025

This PR is nice, although I wonder why you specifically chose Zopflipng for the optimization, because as far as I am aware it's a mostly unchanging piece of software that isn't getting improvements these days.

Did you try out other optimizers, like Oxipng? (Disclaimer: I'm a Oxipng contributor.)

@Zallb
Copy link
Contributor Author

Zallb commented Jan 23, 2025

This PR is nice, although I wonder why you specifically chose Zopflipng for the optimization, because as far as I am aware it's a mostly unchanging piece of software that isn't getting improvements these days.

Did you try out other optimizers, like Oxipng? (Disclaimer: I'm a Oxipng contributor.)

Because most MTA assets (this repo included) use the same tool to optimize images (https://forum.multitheftauto.com/topic/119032-tool-png-optimizer)

Maybe if Oxipng well outperforms this tool, it might be worth to have everything re-optimized.. Last time I downloaded the installer I was shocked by the 100+ MB size

@AlexTMjugador
Copy link
Member

I see, I was not aware of that forum post. It's fair enough to try to keep things simple by standardizing on a single PNG optimizer.

On the topic of Oxipng's install size, it'd be interesting to note where you're getting it from, because the upstream CLI binaries for the v9.1.3 release are only around ~600 KiB big. So any significant size difference ought to be caused due to additional features or bundled software.

@Dutchman101
Copy link
Member

Dutchman101 commented Jan 28, 2025

ZopfliPNG preserves every pixel, so there's not even a microscopic visual difference, yet it hugely reduces size and therefore the texture it loads into memory (client performance). Other PNG 'optimizers' like the one you mentioned don't do this.

That a project isn't very active doesn't mean much, if it's feature complete. It is, because that use is its goal and it works perfectly.

I see, I was not aware of that forum post. It's fair enough to try to keep things simple by standardizing on a single PNG optimizer.

FYI, we standardized on ZopfliPNG, for the aforementioned reasons. It was also applied across the mtasa-blue project.

@AlexTMjugador
Copy link
Member

ZopfliPNG preserves every pixel, so there's not even a microscopic visual difference, yet it hugely reduces size and therefore the texture it loads into memory (client performance). Other PNG 'optimizers' like the one you mentioned don't do this.

Oxipng can also preserve the exact same pixel color and transparency (alpha) values, in addition to using Zopfli as a compression backend for pixel data. But those behaviors depend on how you set it up. The documentation for it is available on the manual file on its repository and other places. Interestingly, Oxipng natively supports multithreading, which can come in handy when optimizing lots of PNGs at once.

That a project isn't very active doesn't mean much, if it's feature complete. It is, because that use is its goal and it works perfectly.

Well, one thing I learned when writing my own compression code is that no such thing as a practical, general-purpose perfect compression encoder for arbitrary inputs exists 🙂. People come up with different ways to encode data all the time; even ML autoencoder models (yes, AI) have applications in data compression. Oxipng could be (or could not be) a better way. It definitely does some things differently to ZopfliPNG.

Of course, as I stated before, if sticking to ZopfliPNG is still desired then so be it. I just wanted to make clear what Oxipng can do and how it could (or could not) be an improvement.

@Nico8340
Copy link
Contributor

Merge :shipit:

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

Successfully merging this pull request may close these issues.

5 participants