Last active
December 20, 2015 16:59
-
-
Save JakeRTFM/6165876 to your computer and use it in GitHub Desktop.
Photoshop script for get PNG from layer in a group by hide/show one by one.
This file contains 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
main(); | |
function main(){ | |
var doc = activeDocument; | |
var docPath = activeDocument.path; | |
var marketApps = doc.layerSets.getByName("Group Name"); | |
for(var a=0; a<marketApps.layers.length; a++){ | |
//alert(marketApps.layers[a]); | |
marketApps.layers[a].visible = true; | |
saveAsPNG(marketApps.layers[a].name); | |
marketApps.layers[a].visible = false; | |
} | |
// LayerSets = group | |
alert(marketApps.layers.length); | |
} | |
function saveAsPNG(nameFile){ | |
var Name = app.activeDocument.name.replace(/\.[^\.]+$/, ''); | |
var Ext = decodeURI(app.activeDocument.name).replace(/^.*\./,''); | |
if(Ext.toLowerCase() != 'psd') return; | |
var Path = app.activeDocument.path; | |
var saveFile = File(Path + "/" + nameFile +".png"); | |
if(saveFile.exists) saveFile.remove(); | |
SavePNG(saveFile); | |
} | |
function SavePNG(saveFile){ | |
pngSaveOptions = new PNGSaveOptions(); | |
activeDocument.saveAs(saveFile, pngSaveOptions, true, Extension.LOWERCASE); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment