Skip to content

Instantly share code, notes, and snippets.

@gerardpaapu
Created October 2, 2011 22:18
Show Gist options
  • Save gerardpaapu/1258044 to your computer and use it in GitHub Desktop.
Save gerardpaapu/1258044 to your computer and use it in GitHub Desktop.
Make an 8-bit png and strip the gamma headers
#!/bin/sh
filename=$(basename $1)
outputdir=$(dirname $1)
tempdir=$(mktemp -d -t 'png')
tempfile1="$tempdir/$filename"
tempfile2=$(mktemp -t 'png')
outputfile="$outputdir/$filename"
pngnq -f -e '.png' -d $tempdir $outputfile &&
pngcrush -q -rem cHRM -rem gAMA -rem iCCP -rem sRGB $tempfile1 $tempfile2 &&
mv $tempfile2 $outputfile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment