Created
December 15, 2013 23:40
-
-
Save augustorsouza/7979918 to your computer and use it in GitHub Desktop.
Sample helper script to create images generated by dragging pixelmator's layers to finder from @2x resolution to normal resolution and facilitates its use in iOS projects
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
# Add [email protected] string end to those exported using Pixelmator | |
Dir.glob("./*2x.png").each do |old_path| | |
next if old_path =~ /@2x.png/ | |
ext = File.extname(old_path) | |
filename = File.basename(old_path, ext) | |
new_filename = filename.sub("2x", "@2x") + ext | |
File.rename(old_path, new_filename) | |
end | |
# Use image magick to generate hald sized images | |
Dir.glob("./*@2x.png").each do |full_image| | |
half_image = full_image.sub("@2x", "") | |
system "convert #{full_image} -resize 50% #{half_image}" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment