Skip to content

Instantly share code, notes, and snippets.

@Overbryd
Created May 28, 2009 12:42
Show Gist options
  • Save Overbryd/119269 to your computer and use it in GitHub Desktop.
Save Overbryd/119269 to your computer and use it in GitHub Desktop.
Fix PNG colorspace issues (vs. CSS colorspace) using pngcrush
#!/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