Created
November 19, 2010 19:50
-
-
Save scottdavis/707029 to your computer and use it in GitHub Desktop.
Down convert images for older iphones
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
| def get_images | |
| Dir['*.{png, gif, jpeg}'] | |
| end | |
| def image_is_2x?(image) | |
| image.include?('@2x') | |
| end | |
| get_images.each do |image| | |
| old_image = image | |
| unless image_is_2x? image | |
| parts = image.split('.') | |
| newname = "#{parts[0]}@2x.#{parts[1]}" | |
| puts "Renaming #{image} to @2x" | |
| system("mv #{image} #{newname}") | |
| image = newname | |
| end | |
| puts "Converting #{image} to 50% as #{old_image}" | |
| system("convert #{image} -filter Lanczos -resize 50% #{old_image}") | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment