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() |
I have managed to get the animation into a video group in Photoshop (as a .mov) and then converted my other groups of layers into groups of video groups. As the file goes through the various layers in the group, it needs to be added to a render queue rather than saved as a png.
It would be great if you share your code here.
Hi Sambat!
I guess that is the problem. I am not a coder. Wondering if I could pay you to write a script for me? I can’t tell if it is better to use Photoshop or After Effects to make the animated NFTs.
I have attached a link to sample files. One is a quicktime animation of a character. The other is the photoshop file with the color and money layer groups. https://1drv.ms/u/s!AlmwxWC8_hF4g4k9fQGvTWAUbsXhig?e=gDUPDx
I have 106 characters in my series. I used your script to make 10,000+ static cards. Now I want to make 10,000+ animated cards in the same color and money combinations.
Please let me know if you are interested and how much you want to charge.
Artis
Hi
Checking to see if you received the email I sent yesterday. Let me know if you are interested.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi
I have used this to create static NFTs. I have a character and then need to change background color and icon. I also have animated the characters. How do I change this code to work on an animated character in photoshop or aftereffects? i.e the character is animated and the background color and icon change