Cropping an Image

I would like to do something like this:

crop this_image to dimensions {(docWidth-120), (docHeight-120)}

But, this returns an error. How do I simply crop the image minue 120 pixels on each side?

launch photoshop, select the select tool, command shift i then delete

I dont know if you can do it with out scripting an app, not sure though
:? :?

Maybe try Image Events.

I haven’t tried Image Events yet myself, but have a look.

The following mostly lifted from Apple’s website:


set this_file to choose file
tell application "Image Events"
set this_image to open this_file
set {docWidth, docHeight} to the dimensions of this_image
crop this_image to dimensions {docWidth-120, docHeight-120}
save this_image with icon
close this_image
end tell
on error error_message
display dialog error_message
end try

This will crop 60 pixels from the top, bottom, left and right.


ktam, that was it. it works great thanks!

now, do you know how to add a stroke in the same mannor?

this is what i’ve found so far:

tell application "Adobe Photoshop CS"
     stroke this_image width {4} location {inside}
end tell

it gives me some weird error. can you have a tell within a tell?