A
A
Aison2020-09-03 02:33:46
Image processing
Aison, 2020-09-03 02:33:46

How to solve the problem with actions?

Guys, such a problem: how to record a frame so that it is not attached to the edited photo and simply cuts the area you need, like 16:9, etc. ?

Why doesn't photoshop apply cropping to all images. Because all the pictures are of different sizes and resolutions, and it is impossible to apply cropping in the operation, because it does not record it as a 16:9 crop, but takes information from the edited photo, and saves this step, for example, with the parameters: indent from the bottom so many pixels , indent from above and so on, to other photos. Actually, this format is not used, because everyone turns out different.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
DarkWood, 2020-09-05
@Aison

In actions you won't do this because you won't be able to calculate the available aspect ratio of the image. But in the script you can.
The simplest example:

// resize image to ratio 16:9

// ----------------------------
// This script resize image for aspect ratio 16:9
// ----------------------------

// create global variables
var doc = app.activeDocument;
var currentLayer = doc.activeLayer;

// get layer size
var layer = activeDocument.activeLayer;
var layerWidth = layer.bounds[2]-layer.bounds[0];
var layerHeight = layer.bounds[3]-layer.bounds[1];

// get layer ratio
var layerRatio = layerWidth / layerHeight;

// calculate new dimensions for canvas with aspect ratio 16:9
var newHeight = layerHeight * 9 / 16 * layerRatio;

//resize canvas
doc.resizeCanvas(layerWidth,newHeight);

To use, save it in JSX format and place it in the C:\Program Files\Adobe\Adobe Photoshop %version%\Presets\Scripts folder. This script can then be called from the File> Scripts menu. For bulk use, write an action that runs the script. For a different aspect ratio, change the appropriate numbers in the script.
Note that only a narrow central part will remain from portrait images at a 16:9 aspect ratio (how narrow depends on its height).
Well, you can just use ImageMagick.
magick *.jpg -gravity center -extent 16:9 -set filename:f %t result/%[filename:f].jpg

It will save all JPG files in the current directory to the result folder, keeping the original name.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question