Created
May 28, 2009 12:42
-
-
Save Overbryd/119269 to your computer and use it in GitHub Desktop.
Fix PNG colorspace issues (vs. CSS colorspace) using pngcrush
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
#!/usr/bin/env ruby | |
# this script is up to remove PNG colorspace information in order to display png's correctly along with css colors | |
# it requires pngcrush to be installed | |
# $ sudo port install pngcrush | |
Dir[File.join(%w(public images ** *.png))].each do |pngfile| | |
newfile = File.join(File.dirname(pngfile), 'new_' + File.basename(pngfile)) | |
`pngcrush -rem gAMA -rem cHRM -rem iCCP -rem sRGB #{pngfile} #{newfile}` | |
`mv #{newfile} #{pngfile}` | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment