Created
October 31, 2011 17:13
-
-
Save luisparravicini/1328035 to your computer and use it in GitHub Desktop.
Revert optimizations made on .png files for iOS and leave them on their corresponding directory (if all the png are in a single dir, use pngcrush -d instead).
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
require 'fileutils' | |
include FileUtils | |
$dir = ARGV.shift | |
if $dir.nil? | |
puts "usage: #{$0} <dir>" | |
exit 1 | |
end | |
Dir.glob("#{$dir}/**/*.png").each do |path| | |
tmp_path = path + '.tmp' | |
out = `/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/pngcrush -revert-iphone-optimizations "#{path}" "#{tmp_path}" 2>&1` | |
raise "error: #{out}" unless $?.success? | |
mv(tmp_path, path) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment