Skip to content

@danielpunkass /gist:2854083
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Zsh functions for easily "fixing" iOS-optimized PNG files
function fixpng ()
{
if [[ ! -f $1 ]] ; then
echo "Usage: fixpng <inputFiles> [outputFile]"
return -1
else
local inputFile=$1
local outputFile=$1
if [[ -e $2 ]] ; then
outputFile=$2
else
zmodload zsh/regex
local baseName=$1
[[ $inputFile -regex-match "^(.*).png" ]] && baseName=$match[1]
outputFile=$baseName-fixed.png
fi
echo Writing fixed PNG to $outputFile
"`xcode-select -print-path`/Platforms/iPhoneOS.platform/Developer/usr/bin/pngcrush" -q -revert-iphone-optimizations $inputFile $outputFile
fi
}
# Fix a whole mess of pngs at once
fixpngs ()
{
if [[ ! -f $1 ]] ; then
echo "Usage: fixpng <inputFiles> [outputFile]"
return -1
else
for i in "$@"; do fixpng ./"$i"; done;
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.