tell application "Finder"
set originalImages to choose file with prompt "Please select the images to process:" of type {"public.image"} with multiple selections allowed
set exportLocation to choose folder with prompt "Please select where you'd like export the images:"
set originalImageNames to {}
repeat with a from 1 to number of originalImages
copy name of item a of originalImages to end of originalImageNames
end repeat
end tell
tell application "Pixelmator Pro"
repeat with a from 1 to number of originalImages
set currentImage to open item a of originalImages
set imageName to item a of originalImageNames
enhance currentImage
tell currentImage to resize image width 2500 resolution 72 algorithm bilinear
tell currentImage to resize image height 2500 resolution 72 algorithm bilinear
export currentImage to file ((exportLocation as text) & imageName & ".jpg") as JPEG with properties {compression factor:80}
close currentImage without saving
end repeat
display notification (number of originalImages as text) & " images exported to Jpeg." with title "Export to JPEG"
end tell
Create Apple Script to Resize Long Edge of Image Before Exporting
2020-11-24 16:42:16
Hi, I'm trying to create an Apple Script that will resize the image Long Edge to a given value like 2500px. So depending on whether the image is in portrait or landscape, I'd like the script to choose the longest edge and scale it down proportionally. Thank you in advance.
2020-11-26 16:14:16
Hey there, this should work for you:
tell application "Pixelmator Pro Beta"
set originalImages to choose file with prompt "Please select the images to process:" of type {"public.image"} with multiple selections allowed
set exportLocation to choose folder with prompt "Please select where you'd like export the images:"
repeat with a from 1 to number of originalImages
set currentImage to open item a of originalImages
set imageName to name of currentImage
enhance currentImage
if width of currentImage is greater than height of currentImage then
tell currentImage to resize image width 2500 resolution 72 algorithm bilinear
else
tell currentImage to resize image height 2500 resolution 72 algorithm bilinear
end if
export currentImage to file ((exportLocation as text) & imageName & ".jpg") as JPEG with properties {compression factor:80}
close currentImage without saving
end repeat
display notification (number of originalImages as text) & " images exported to Jpeg." with title "Export to JPEG"
end tell
Hope that helps!