Created
September 14, 2013 16:55
-
-
Save douglashill/6563622 to your computer and use it in GitHub Desktop.
Commands Acorn to export an iOS app icon in all useful sizes for iOS 6 and iOS 7. As written, this script assumes there is a square image named icon.acorn on my desktop, and writes the output files to the desktop. Flattening is performed inside the loop because it did not work when I put it outside. No changes are made to the original file, alth…
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
var sizes = [29, 40, 50, 57, 58, 72, 76, 80, 100, 114, 120, 144, 152, 1024]; | |
var acorn = JSTalk.application("Acorn"); | |
var doc = acorn.open("/Users/Douglas/Desktop/icon.acorn"); | |
for (idx = 0; idx < sizes.length; idx++) { | |
doc.flattenImage(); | |
doc.scaleImageToWidth(sizes[idx]); | |
doc.dataRepresentationOfType("public.png").writeToFile("/Users/Douglas/Desktop/icon-" + sizes[idx] + ".png"); | |
doc.undo(); | |
} | |
doc.close(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
pst:
doc.flattenImage(nil);
that should be more reliable, even though it's a private api.