Clicky

iOS Dev Nugget 38 Bulk Generate 1x Images From 2x Retina Images

.

Need to run a code review on your codebase? Hire me

It's common to tweak your @2x images. You might not want to spend double the effort to tweak the normal version of your images especially when you know that you might be tweaking them again. If you install ImageMagick[1], here's 2 handy commands that will help you generate the normal version of the images from your @2x version. Be careful they override any existing normal images. In a terminal, cd to your project directory and run:

find . -name "*@2x.png" | xargs mogrify -format PNG32 -resize 50%
find . -name "*@2x.PNG32" | sed -e "p;s/@2x.PNG32/.png/" | xargs -n2 mv

[1] You can install ImageMagick using Homebrew.


Your feedback is valuable: Do you want more nuggets like this?   Yes   or   No

.

Like this and want such iOS dev nuggets to be emailed to you, weekly?

Sign Me Up! or follow @iosdevnuggets on Twitter

.

View archives of past issues