• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit Search
0

Cropping to a fixed ratio as an action

New Here ,
Feb 06, 2020 Feb 06, 2020

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:

Capture.PNG

 

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: 

1Capture.PNG

 

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?

 

TOPICS
Actions and scripting

Views

2.9K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Feb 06, 2020 Feb 06, 2020

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

...

Votes

Translate

Translate
Community Expert ,
Feb 06, 2020 Feb 06, 2020

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. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 06, 2020 Feb 06, 2020

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

Example
Download

 

 

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.

image.png

image.png

 

 

The Plug-in allow you to record in an action an Aspect Ratio Selection and center it relative to the document size.

Capture.jpg

JJMack

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 07, 2020 Feb 07, 2020

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 26, 2023 Jan 26, 2023

Copy link to clipboard

Copied

LATEST

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines