Applescript, crop based on selection without deleting pixels
I'm trying to crop the image in the same way you would in photoshop.
You select the area with the marquee then select the crop tool, this then has the tick box to crop without deleting the pixels.
How can I do this please?
I believe the crop that I use below is from the menu item and not the crop tool.
tell application id "com.adobe.photoshop"
set ruler units of settings to pixel units
tell current document
trim basing trim on top left pixel
set {height:originalHeight, width:originalWidth} to it
log originalWidth
log
select region {{0, (originalHeight / 2)}, {originalWidth, (originalHeight / 2)}, {originalWidth, originalHeight}, {0, originalHeight}} without antialiasing
set theCropBounds to bounds of selection
--crop based on selection without deleting pixels as per crop tool not crop in the menu item
crop bounds theCropBounds
--reveal all
end tell
end tell
