High-Res Artwork Management Automation

Fri, 22. Oct 2010

Categories: en development Tags: ImageMagick iPhone iPhone4 make Makefile Retina Display

The iPhone4 comes with a super high-res display and to leverage that encourages App Developers to provide all artwork twofold โ€“ once „normal“ and once in double resolution named equally with a „@2x“ suffix.

To ease my designers’ life and avoid confusion (and designers are easily confused I found) I ask them to provide the high-res artwork only and I scale it down myself. And as this is a reoccuring task, I automated via a Makefile like this:

 1#!/usr/bin/make
 2# Make help: http://www.gnu.org/software/make/manual/html_node/Phony-Targets.html#Phony-Targets
 3
 4# Requires ImageMagick, Installation per macport: $ sudo port install imagemagick +no_x11
 5CONVERT :=  convert
 6
 7# Where are the images?
 8ASSETS_DIR := .
 9
10# Which ones? All @2x.png plus twins without @2x.png
11ASSETS_HIGH :=  $(wildcard $(ASSETS_DIR)/*@2x.png)
12ASSETS_LOW  :=  $(patsubst %@2x.png,%.png,$(ASSETS_HIGH))
13
14# The scaling command
15%.png: %@2x.png
16  convert $< -resize 50% $@
17
18assets: $(ASSETS_LOW)
19
20clean:
21  -rm $(ASSETS_LOW)

See also myย link collection about high-res images and my general Xcode project setup.