Skip to main content
Known Participant
August 17, 2012
Question

Cropping different file sizes script

  • August 17, 2012
  • 2 replies
  • 3812 views

I'm trying to come up with a way to have an action and script that will let me crop an image to 8x10 or 5x7 for example. What happens though is that if the image is a different size (resolution wise) when the action stops to allow me to do the crop, the crop guides will be a different size (depending on the initial resolution of the action set up image) or location on the image causing me to move the handles to get it back in to the new image. I would like the have the crop guides centered over the image in proportion to whatever resolution the image is. Can this be done?

This topic has been closed for replies.

2 replies

JJMack
Community Expert
Community Expert
August 17, 2012

You should be able to create an action to do that using my Plug-in Script AspectRatioSelection. You can automate a center crop or set upa  a center selection that is transformed 180 degrees and the transform step  made interactive. Hitting enter will accept the current sselection. If you do not like te selection you can move and transform it. Holding the Shift ket will constrain the transform to its current Aspect Ratio once you commit the selection the action will then crop the image. Once cropped the action would then use my second Plug-in script LongSidePrintLength to set the images print DPI so the image will print the size you want without resampling it. These scripts are in my crafting action package.

Crafting Actions Package UPDATED Aug 14, 2012 Changed AspectRatioSelection Plug-in script added Path support.

Contains

Example

Download

JJMack
ocphotogAuthor
Known Participant
August 18, 2012

Thanks for the suggestions. I did figure out that I needed to set the rulers to % when I did the initial crop so that same % would apply to other size files. Works fine now.

JJMack
Community Expert
Community Expert
August 18, 2012

I happy you found something that  works for you.  You stated " I'm trying to come up with a way to have an action and script that will let me crop an image to 8x10 or 5x7 for example." Are you using a action that uses a script if so are you seting ruler units to % for the action or the script or both. 

How does percentage help with making aspect ratio crops. I would think Percent would only work if all your image had the same aspect ratio and orintation to begin with.  If you have images that have different aspect ratios I think your Action + Script might have some poblems. 

For examp images from point and shoot cameras have aspect ration 4:3 and perhaps wide ones 16:9 where image from DSLR have a 3:2 aspect ratio. Also some images are in portrait orintation and some are in landscape orintation.  You may have also cropped some images to an unknown aspect ratio. Are you sure you have tested your solution well???

JJMack
c.pfaffenbichler
Community Expert
Community Expert
August 17, 2012

Mind sharing a few more details or the Script you currently use?

ocphotogAuthor
Known Participant
August 17, 2012

Sure,

The action does a fit to screen then calls the 8x10 crop.js to determing if it's a vertical or horizontal image.

8x10 crop.js:

if (activeDocument.width > activeDocument.height)

doAction("Horizontal","Crop to 8x10 Format.atn");

else if (activeDocument.width < activeDocument.height)

doAction("Vertical","Crop to 8x10 Format.atn");

this script runs the action for vert or horiz with crop tool set at 8x10 with no resolution set. Where it get placed on the image varies depending on the original size the image is since it could have been based on an older cameras file size at the time the action was made.

It's pretty basic I guess.