: Create new photos from a photo based on variations of an adjustment I have a picture here and I want to apply an adjust (brightness for example) and save like 40 pictures, each one with a
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.
More posts by @Dunderdale640
1 Comments
Sorted by latest first Latest Oldest Best
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.
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.
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
app.bringToFront();
main();
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!");
return;
}
//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));
fileList.sort().reverse();
if(fileList.length == 0){
saveFile=File(folderPath + "/" + fileName + "0001." +fileType);
activeDocument.saveAs(saveFile, SaveDocumentType.PNG, true, Extension.LOWERCASE); //Leó 22/02/2018
}else{
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;
};
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.