batch crop images on each side by 40 pixels

Upload Photoshop Scripts, download Photoshop Scripts, Discussion and Support of Photoshop Scripts

Moderators: Tom, Kukurykus

andreas
Posts: 1
Joined: Wed Feb 22, 2017 10:55 am

batch crop images on each side by 40 pixels

Post 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
User avatar
Kukurykus
Posts: 528
Joined: Mon Jul 25, 2016 12:36 pm

Re: batch crop images on each side by 40 pixels

Post 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
Attachments
Canvas Resize 2.rar
(557 Bytes) Downloaded 626 times