I have a picture here and I want to apply an adjust (brightness for example) and save like 40 pictures, each one with a different level of brightness. Is there a way to do this automatically? I use gimp and Photoshop.

  • 1
    How would it do it automatically, if you are doing a different adjustment? (or are the pictures different levels - but doing the same adjustment) – WELZ Feb 22 '18 at 13:49

Not Gimp or Photoshop, but using ImageMagick, a command-line toolbox:

for b in $(seq -w 2 2 80);do convert in.jpg -brightness-contrast +$b out-$b.jpg;done

The above command works in Linux and should work on OS/X, and in Windows there is an equivalent FOR /L %%parameter IN (start,step,end) DO command. In recent versions of ImageMagick, use magick convert instead of convert.

enter image description here


This took me a lot of efford...

First you save the code at the bottom as AddNumberPng.jsx, or whatever you want in the Photoshop Scripts Folder.

Now edit the code and change the directory to your desired folder. In the code below it is "~/Desktop/MacWin".

Restart the Photoshop just in case it is open.

Create a new adjustment Layer. In my exemple I created a Brightness/contrast with a brightness value of 5.

enter image description here

With the adjustment Layer selected, Create a new Action.

Press Ctrl + J to duplicate the adjustment Layer. This will increase its value.

Go to Menu > File > Scripts> AddNumberPng.

Stop recording the Action.

enter image description here

Everytime you play this action your file will be saved in the desired folder with a name0001.png, name0002.png… and increasing the adjustment effect by 5.

The code:

    #target photoshop  
function main(){  
if(!documents.length) return;  
//amend to suit  
var folderPath = Folder("~/Desktop/MacWin");  //You can change this directory
if(!folderPath.exists) {  
    alert("Output folder does not exist!");  
//this should be the first part of the filename   
//I.E. if file name = Picture0001.png it needs to be Picture  
//N.B. it must be the same case!  
var fileName  = "filename";  
var fileType = "png";                           //Leó 22/02/2018
var fileList = new Array();  
var newNumber=0;  
var saveFile='';  
fileList = folderPath.getFiles((fileName + "*." + fileType));  
if(fileList.length == 0){  
saveFile=File(folderPath + "/" + fileName + "0001." +fileType);  
activeDocument.saveAs(saveFile, SaveDocumentType.PNG, true, Extension.LOWERCASE);   //Leó 22/02/2018
newNumber  = Number(fileList[0].toString().replace(/\....$/,'').match(/\d+$/)) +1;  
saveFile=File(folderPath + "/" + fileName + zeroPad(newNumber, 4) + "." +fileType);  
activeDocument.saveAs(saveFile, SaveDocumentType.PNG, true, Extension.LOWERCASE);   //Leó 22/02/2018      
function zeroPad(n, s) {   
   n = n.toString();   
   while (n.length < s)  n = '0' + n;   
   return n;   

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.