I cobbled together a script to make @2x and @3x versions of the current @1x document (72dpi) that’s open in Photoshop.
It all works apart from the fact that it doesn’t scale vector strokes:
try
tell application id "com.adobe.Photoshop"
set document_1x to the current document
set fullDocumentPath to (file path of document_1x as text)
set documentName to name of document_1x
set documentNameCount to (count of documentName) as text
set documentBaseName to (items 1 thru ((length of documentName) - 6) of documentName) as string
set filePath to (items 1 thru ((length of fullDocumentPath) - documentNameCount) of fullDocumentPath) as string
tell document_1x
(* Create @2x document *)
resize image resolution 144
set newDocument2x to filePath & documentBaseName & "2x" as string
save in file newDocument2x as Photoshop format appending lowercase extension with copying
(* Create @3x document *)
resize image resolution 216
set newDocument3x to filePath & documentBaseName & "3x" as string
save in file newDocument3x as Photoshop format appending lowercase extension with copying
end tell
close document_1x without saving
set document_1x to fullDocumentPath
end tell
tell application "Finder"
open newDocument3x & ".psd"
open newDocument2x & ".psd"
open document_1x
end tell
end try
If I resize the images manually (Image > Image Size) I can turn on an option to ‘Scales Styles’ which also scales strokes when resizing.
I’ve worked around it by creating actions for resizing (which scales the strokes) and run the actions from within the script
do action "Scale to 2x" from "Ps Actions"
But ideally I’d like to do it without running separate actions if possible.
Does anyone know how to do this, or if it’s even possible?