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

ALL: Run optipng to reduce png file size #2537

Open
wants to merge 1 commit into
base: master
from

Conversation

@mduggan
Copy link
Contributor

@mduggan mduggan commented Oct 17, 2020

The optipng tool reduces png file size with no difference in output. This helps create smaller deployables, and in my experience it's totally safe.

Doing as a PR anyway so people can have a look and check it doesn't break anything.

@henke37
Copy link
Contributor

@henke37 henke37 commented Oct 17, 2020

Not a bad idea, but I'd like to see it automated.

@dreammaster
Copy link
Member

@dreammaster dreammaster commented Oct 17, 2020

Good idea. Though at least for the Ultima related files, the .dat file would need to be regenerated to take advantage of the smaller sizes, and I'm a bit leery of doing that, and adding to the size of the Git repository, unless we have some other bugfixes or new content being added to warrant it.

@mduggan
Copy link
Contributor Author

@mduggan mduggan commented Oct 18, 2020

Not a bad idea, but I'd like to see it automated.

Do you mean in a script? I don't think we should go as far as adding a git hook, so here's the script..

for x in  `find . -name \*.png`; do optipng $x; done

I guess I could add that to the Makefile, but it couldn't be fully automatic, you basically have to run the program to see if it does anything. So you'd just have a make target people have to know about already, at which point you can almost as easily just write that command above :)

@mduggan
Copy link
Contributor Author

@mduggan mduggan commented Oct 18, 2020

.. I'm a bit leery of doing that, and adding to the size of the Git repository, unless we have some other bugfixes or new content being added to warrant it.

Agreed - it's probably not worth generating the ultima.dat just for this, but we can put this there for the next time it gets regenerated for some other reason - I'm sure it will come up at some point.

@mgerhardy
Copy link
Contributor

@mgerhardy mgerhardy commented Oct 25, 2020

Does optipng use quantization? I've used pngquant to reduce the size for my other games a lot.

@mduggan
Copy link
Contributor Author

@mduggan mduggan commented Oct 25, 2020

optipng should leave the pixel data identical, it just recompresses using more efficient tables etc. There's some technical details on what it does here:
http://optipng.sourceforge.net/pngtech/optipng.html

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

Successfully merging this pull request may close these issues.

None yet

4 participants
You can’t perform that action at this time.