Merged
Conversation
Owner
|
command ran? |
Author
function rcomp() {
find . -name "*.png" -type f -exec oxipng -o max -a -s {} \;
find . -name "*.png" -type f -exec pngout {} \;
find . -name "*.png" -type f -exec oxipng -o max --zopfli -a -s {} \;
find . -name "*.png" -type f -exec defluff-shim {} \;
find . -name "*.png" -type f -exec deflopt {} \;
}where #!/usr/bin/env bash
# this arcane incantation converts linux paths to windows paths in the first arg
# you'll see it again in a second
set -- $(echo "$1" | sed 's/\//\\/g') "${@:2}"
# you can try different values after b, but i've found 128 to give the best results
wine /usr/bin/pngout.exe "$@" "/b128" "/k1" "/q"and #!/usr/bin/env bash
if [ $# -eq 1 ]; then
defluff < "$1" > ~/.cache/defluff-shim-tmp.png
oldsize=$(wc -c < "$1")
newsize=$(wc -c < ~/.cache/defluff-shim-tmp.png)
if [[ newsize -lt oldsize ]]; then
rm "$1"
mv ~/.cache/defluff-shim-tmp.png "$1"
else
rm ~/.cache/defluff-shim-tmp.png
fi
else
echo 'usage: defluff-shim (path)'
fiand #!/usr/bin/env bash
set -- $(echo "$1" | sed 's/\//\\/g') "${@:2}"
wine /usr/bin/DeflOpt.exe "$@"
defluff and deflopt are the final steps that shave off the last tiny bytes by, as far as i understand it, optimizing the headers. pngout is a png compressor with different characteristics than opti/oxipng, it seems to excel at images with large blobs of shared color and small amounts of color from what i can tell. chaining it between the two oxipng calls gave me the best results i'll probably make a blogpost about this sometime... |
1 task
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
learned a few new tricks since last time! mostly single-byte improvements but some sprites like the new icon and atlas texture weren't compressed at all yet, plus the book got some bigger wins too.