Page 1 of 1

batch crop images on each side by 40 pixels

Posted: Wed Oct 25, 2017 6:27 am
by andreas
Dear Experts:

I need to crop a batch of photographs by 40 pixels on each side. They all have totally different sizes. It is the 40 pixels on each side which will be constant.

Is it possible to run a script for this task or may be even an action I do not know how to set up.

Help is much appreciated.

Thank you very much in advance.

Regards, Andreas

Re: batch crop images on each side by 40 pixels

Posted: Wed Dec 13, 2017 9:23 pm
by Kukurykus
To use this script, copy it to Presets / Scripts of your Photoshop folder.
Then reopen Photoshop and you will find it on the list in of File / Scripts.

Code: Select all

if (fld = Folder.selectDialog('Select folder:')) {
preferences.rulerUnits = Units.PIXELS,
(prc = Folder(fld + '/Processed')).create()
for(fld = fld.getFiles(/jpg|psd/i); i < fld.length; i++) {
open(fld[i]), (aD = activeDocument).resizeCanvas(aD.width - 40, aD.height - 40)
aD.saveAs(File(prc + '/' + aD.name)), aD.close(SaveOptions.DONOTSAVECHANGES)
}
}
You may also try my other very similar script: https://forums.adobe.com/message/8948511#8948511