batch crop images on each side by 40 pixels

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

Moderators: xbytor, DavideBarranca, Paul MR

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

batch crop images on each side by 40 pixels

Postby andreas » Wed Oct 25, 2017 6:27 am

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: 138
Joined: Mon Jul 25, 2016 12:36 pm

Re: batch crop images on each side by 40 pixels

Postby Kukurykus » Wed Dec 13, 2017 9:23 pm

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 7 times


Return to “Photoshop Scripts”

Who is online

Users browsing this forum: No registered users and 2 guests