cropping a jpeg image

Greetings to all. I’m very new to Applescript. I need a script that will open a jpeg image (in either Photoshop CS or Photoshop Elements 2.0), crop it and save it again. I’ve gotten as far as opening the image, but cropping and saving eludes me. Any help would be greatly appreciated. Thank you so much!

If you’re running 10.3, have you looked at using image events? I haven’t used it yet, as I just upgraded to 10.3 today (:D). It can crop and save, and would eliminate the need to open PS at all…assuming that interests you. There’s a bit more info in This Thread. I haven’t scripted cropping in PS, but it is certainly possible if you can figure out the syntax.

Good luck…
j

I’m running 10.2.8. I’m guessing it doesn’t support image events :cry: . I don’t care what app or utility crops the image. I simply need to specify the bounding limits (I suppose in pixel coordinates, upper left and lower right). If 10.3 can do it faster than opening PS, then that’s probably what I should do. Thanks for the reply.

If you want to be able to specify the boundling limits I don’t think that Image Events will do the job as Image Events cropping is limited to achieving a certain ratio of width to height and will do the minimum cropping required to achieve the ratio.

YVS Picture Translator can do the job, faster than photoshop and is free

http://homepage.mac.com/ktam2/yvs

Or iMagine Photo can also do the job, but is not free.

http://www.yvs.eu.com/

Disclaimer: I am the author of both. Both will run on 10.2 and up.

Kevin

Kevin,

Thanks so much. I’ve downloaded YVS Picture Translator and it seems an excellent and very powerful program. So that I might get started quickly, I wonder, can you give me the correct code for opening a list of images, cropping, and saving them?


-- something like this ? ...

set x to 1
tell application "YVS Picture Translator"
      repeat until x = 100
           set x to x+1
           set image_file_name to "image" & x
           open file image_file_name & ".jpg"
           crop image {0,50,599,320}
           save file image_file_name & "_cropped" & ".jpg"
      end repeat
end tell

If you save the following script as an application from within script editor it will crop all image files that you drop on the application to the dimensions that you gave me.

I hope that helps.

Kevin


[This script was automatically tagged for color coded syntax by Convert Script to Markup Code]

Thanks, Kevin. That’s a big help. I appreciate your time.

best regards,
Ted