Answer the question
In order to leave comments, you need to log in
Are there conditions in an action in Photoshop? or how to stretch the canvas if it is less than 700x700, and if the picture is larger, too?
Actually in title a question. in my action, when setting all the pictures to the canvas size - 720x720 - which displays less than the norm. but with images that have their size larger than 720x720, they are cut down and only part of it is visible - that is, the image size must also be changed. - but if I do this to all the pictures, then in the case of small ones, the picture will be enlarged - what pixels will be visible on it (the quality will suffer a lot) - in fact, this is why I ask the question. Thanks for the reply, who knows
Answer the question
In order to leave comments, you need to log in
In short, I added a condition.
var uNewSize = new UnitValue(800, "px");
var uLimit = new UnitValue(700, "px");
var dir = new Folder("D:\\ImagesFolder");
displayDialogs = DialogModes.NO;
if (dir != null) {
var fileList = dir.getFiles("*.jpg");
for (var i = 0; i < fileList.length; i++) {
try {
open( fileList[i] );
if ((app.activeDocument.width < uLimit)&&(app.activeDocument.height < uLimit)) {
app.activeDocument.resizeCanvas(uNewSize, uNewSize, AnchorPosition.MIDDLECENTER);
app.activeDocument.save(SaveOptions.SAVECHANGES);
}
app.activeDocument.close();
}
catch(e) {
// бла-бла
}
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question