Created
July 25, 2021 07:30
-
-
Save sambatlim/3d145f4dc4b2f5d8ef641b18a39ac93c to your computer and use it in GitHub Desktop.
Script to generate save image from each group in photoshop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Main() { | |
var num = 1; | |
for (var j = 0; j < app.activeDocument.layerSets[0].layers.length; j++) { | |
for (var k = 0; k < app.activeDocument.layerSets[1].layers.length; k++) { | |
for (var l = 0; l < app.activeDocument.layerSets[2].layers.length; l++) { | |
var groupChildArr1 = app.activeDocument.layerSets[0].layers; | |
var groupChildArr2 = app.activeDocument.layerSets[1].layers; | |
var groupChildArr3 = app.activeDocument.layerSets[2].layers; | |
app.activeDocument.layerSets[0].visible = true; | |
app.activeDocument.layerSets[1].visible = true; | |
app.activeDocument.layerSets[2].visible = true; | |
groupChildArr1[j].visible = true; | |
groupChildArr2[k].visible = true; | |
groupChildArr3[l].visible = true; | |
Save(num); | |
num++; | |
Revert(); | |
} | |
} | |
} | |
} | |
function Save(num) { | |
var outFolder = app.activeDocument; // psd name | |
var outPath = outFolder.path; | |
var fName = "PNG"; // define folder name | |
var f = new Folder(outPath + "/" + fName); | |
if (!f.exists) { | |
f.create() | |
} | |
var saveFile = new File(outPath + "/" + fName + "/" + "Pattern_" + num + ".png"); | |
pngSaveOptions = new PNGSaveOptions(); | |
pngSaveOptions.interlaced = false; | |
app.activeDocument.saveAs(saveFile, pngSaveOptions, true, Extension.LOWERCASE); | |
} | |
function Revert() { | |
var idRvrt = charIDToTypeID("Rvrt"); | |
executeAction(idRvrt, undefined, DialogModes.NO); | |
} | |
Main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi
Checking to see if you received the email I sent yesterday. Let me know if you are interested.