-
Notifications
You must be signed in to change notification settings - Fork 580
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
Safe Compression Commit #2808
Safe Compression Commit #2808
Conversation
We may someday go back and attempt further compression by reducing bit depth, but since 5.4 release is Saturday, let's do the less controversial, safe commit. |
You might want to check out oxipng found at https://github.com/shssoichiro/oxipng. In short it is a rewrite of optipng in rustlang with some enhancements(multithread etc). |
Hi, please may you add a file #!/bin/bash
# Colors with 0 alpha need to be preserved, because opaque leaves ignore alpha.
# For that purpose, the use of indexed colors is disabled (-nc).
find -name '*.png' -print0 | xargs -0 optipng -o7 -zm1-9 -nc -strip all -clobber Any caveats with texture optimisation should be documented. Why are index color modes a problem? |
I don't think it's indexed color specifically but rather the fact that converting it to indexed color will also drop the RGB portion from fully transparent pixels. For that, see https://github.com/minetest/minetest/blob/master/doc/texture_packs.txt#L226-L232 or #2803 (comment) |
Ruben, what do you mean by "add a File" I can do so easily, but I don't know where to put it. |
I was referring to the root of this repository. A |
ac4fec2
to
243ac7c
Compare
Okay, rebased and added optimize_textures.sh as written by Rubenwardy. |
optimize_textures.sh
Outdated
#!/bin/bash | ||
|
||
# Colors with 0 alpha need to be preserved, because opaque leaves ignore alpha. | ||
# For that purpose, the use of indexed colors is disabled (-nc). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please put this in an "utils" folder in case an .obj compression script is added in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moving this to the utils folder is fine by me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, will do. This brings up the question: should I go ahead and add the compress.obj script to the same utils folder in #2807? Then, should I add a readme.md to that folder saying how to use both scripts in a new PR?
Edit: I will update it to work with the updated water textures as well.
Only a single program was used to safely compress all textures in MTG. This was done using optipng with the following settings: ``` optipng -o7 -zm1-9 -nc -strip all -clobber %%f ``` The key command used is -nc, which stops color mode changes. I.e. any RGBA textures will remain RGBA textures, with none being changes to 8-bit indexed mode. The resulting compression: | type | size (Bytes) | % of original texture size | | --- | --- | --- | | Original | 247,571 | 100% | | Compressed | 152,189 | 61.5% | **Summary: Saves 93.14 KB** A script has been added: utils/optimize_textures.sh which will perform this compression automatically, assuming optipng is installed.
243ac7c
to
454bb6d
Compare
Okay, conflicts dealt with, changed the script directory to "utils" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alpha contents are preserved. No texture format warnings. Looks good.
Only a single program was used to safely compress all textures in MTG. * `optipng -o7 -zm1-9 -nc -strip all -clobber %%f` The key command used is -nc, which stops color mode changes. I.e. any RGBA textures will remain RGBA textures, with none being changes to 8-bit indexed mode. utils/optimize_textures.sh performs this compression automatically, assuming optipng is installed.
Addresses #2803 concerns
Only a single program was used to safely compress all textures in MTG.
This was done using optipng with the following settings:
The key command used is -nc, which stops color mode changes. I.e. any RGBA textures will remain RGBA textures, with none being changed to 8-bit indexed mode.
The resulting compression:
Summary: Saves 93.14 KB