Created
August 19, 2015 19:43
-
-
Save gene1wood/3b4b37d5a438871b8876 to your computer and use it in GitHub Desktop.
Search through Eclipse jar files and images and resize them for HiDPI / Retina displays
This file contains 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
#!/bin/bash | |
# Original written by Redsandro in http://stackoverflow.com/a/29032397/168874 | |
for J in *.jar | |
do | |
d="`mktemp --directory`" | |
trap 'rm -rf "$d"' EXIT | |
f="`readlink -f \"$J\"`" | |
echo "Extracting $J..." | |
unzip -q "$f" -d "$d" | |
echo "Processing images in $J..." | |
find "$d" -name "*.gif" -exec sh -c "expr \$(identify -format \"%h\" {}) \<= 16 > /dev/null" \; -exec convert {} -resize 200% {} \; -printf "%f resized\n" | |
echo "Compressing $J..." | |
mv -f "$f" "$f.`date +%Y%m%d%H%M%S`.bak" | |
pushd "$d" >/dev/null | |
zip -qr "$f" . | |
popd >/dev/null | |
rm -rf "$d" | |
done | |
echo "Processing all images outside of jars..." | |
find -name "*.gif" -exec sh -c "expr \$(identify -format \"%h\" {}) \<= 16 > /dev/null" \; -exec convert {} -resize 200% {} \; -printf "%f resized\n" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment