Copy link to clipboard
Copied
I have a batch of images of differing resolutions but at landscape orientation. I want to batch crop these images to all have a similar ratio. When I load the Crop tool and select my custom ratio, the tool manages to create a rectangular selection in the middle of the image at the 2.8x5 ratio that I've selected:
This tool works regardless of what image I select. When I attempt to automate this as an action, the action uses the initial dimensions of the image I used to create the action as the basis of my image:
This happens regardless of whether I hit enter or use the menu to crop my image when creating the action.
I've tried recreating the functionality of the cropping tool via the Rectangular Marquee tool but I am coming up short. I've also fished around on this board and elsewhere on the web for scripts that will allow me to do this automatically, again to no avail. Any suggestions?
A normal action can not be recorder to do what you want. The rectangle Marque tool if you set it to do a fixed aspect ratio of 50:28 you would need to drag out the selection centered and would vary for different size images. The crop tool can be set to crop to an aspect ration and initially it would be centered so all you would need to do is set the aspect ratio and commit the crop. The problem is Action recorder records crop top left and bottom right corners location for a crop. The tool
...Copy link to clipboard
Copied
Either turn on the dialog box, so you can adjust it, or use a script to get the proper dimension of the image for the crop.
Copy link to clipboard
Copied
A normal action can not be recorder to do what you want. The rectangle Marque tool if you set it to do a fixed aspect ratio of 50:28 you would need to drag out the selection centered and would vary for different size images. The crop tool can be set to crop to an aspect ration and initially it would be centered so all you would need to do is set the aspect ratio and commit the crop. The problem is Action recorder records crop top left and bottom right corners location for a crop. The tool will constrain the side aspect ration as you drag the tool around. A centered 5:2.8 top left and bottom right corners would be different for different size documents. Scripting is required.
If you download My crafting Actions Package it contains a dozen or more Scripts I wrote for use in actions. Two are Photoshop Plug-in that work a lot like Adobe Plug-in script Fit Image. I wrote them for Cropping images to an aspect Ratio and settings print size. These settings are recorded into the Action steps by the plug-ins when you record the action. The First plug-in is Aspect Ratio Selection and the second Long Side Print length. Aspect Ratio Selection can set a centered Aspect Ratio Selection you cans crop the image to. You specific two whole numbers in the Dialog. It does not matter which order the numbers are set in the dialog for the script will respect the orientation of your document. Landscape Image will have Landscape selections set and portrait Portrait aspect ratio set. For Cropping and changing orientation of an image would crop to much content the crop's composition would not be acceptable. So if you had a 4:3 camera and the two numbers you set a 3 and 2 Landscaped selections will be 3:2 and Portrait set 2:3. Long Side Print length records 1 number all the script does is set the correct Print PPI to print the longer side the correct length.
Crafting Actions Package UPDATED Aug 10, 2014 Added Conditional Action steps to Action Palette Tips.
Contains
For your Action the aspect ratio you would set would be 28 and 50 and 5 for the print size. That Action would look like this do not be concerned the the stare record pixels only the numeric values are used by the plug-in. For the aspect ratio and the print side length in inches.
The Plug-in allow you to record in an action an Aspect Ratio Selection and center it relative to the document size.
Copy link to clipboard
Copied
Thank you so much for your help! This worked. I appreciate your kindness in taking the time in offering me assistance in this and with you sharing your scripts with the rest of the community. You've helped me through a lot of frustration.
Copy link to clipboard
Copied
These are just what I need!
Does anyone have these scripts available to download? It seems the links are no longer working.
Copy link to clipboard
Copied
These are just what I need!
Does anyone have these scripts available to download? It seems the links are no longer working.
By @Phil276011294g0h
Here you go:
https://github.com/MarshySwamp/JJMack-Archive
https://community.adobe.com/t5/photoshop-ecosystem-discussions/r-i-p-jjmack/m-p/12701028
Copy link to clipboard
Copied
Thanks!
Copy link to clipboard
Copied
Absolute life saver presets. So sorry to hear that JJMack is no longer among us, but wanted to show gratitude for his work nonetheless. R.I.P.
Copy link to clipboard
Copied
Has anyone used this script to acheive an ISO Ratio? The correct ratio is 1.4142 : 1. Entering 14:10 just isnt accurate enough and decimals arent accepted. Any suggetions?
Copy link to clipboard
Copied
Has anyone used this script to acheive an ISO Ratio? The correct ratio is 1.4142 : 1. Entering 14:10 just isnt accurate enough and decimals arent accepted. Any suggetions?
By @Lianne Clarke
The script from JJMack is designed to work in pixels, which are integers.
I have another idea and will look into it for you...
Edit: I can't get the precision to four decimal places in my test action. Initial results have the result of 1.41 : 1 (landscape) 1.42 : 1 (portrait) – so there will be some error on one edge, as it will either undershoot or overshoot. Aiming for a different value and then adjusting the final canvas size to fit the ISO ratio is one possible solution.
This is the same result as using 14 : 10 or 10 : 14 so isn't an improvement.
If you need exact sizes such as A4 paper crops, then you may need something less generic and work in explicit document resolutions that accommodate metric sizing without rounding issues.