Copy link to clipboard
Copied
Hello,
I never did a photoshop script.
I would like to know if it is possible to do this and how to do it?
I have two groups of layers (LOGO and TSHIRTS).
The first with designs.(Logo1,Logo1...)
The second with t-shirts in different colors.(Black,White,Blue,...)
Is it possible to export in jpg each logo on each color of t-shirt?
If possible, can we name the jpg with a suffix + logo layer name + color layer name? (ts-Logo-Blue.jpg)So what give the quality of the jpg to 80%?
I thank you in advance
Copy link to clipboard
Copied
It can be Scripted in JavaScript.
It can be done with two for-clauses (with their numbers of iterations depending on the number of Layers in the two Folders).
Saving and naming jpgs is also not a problem.
Do you have any JavaScript-knowledge?
Copy link to clipboard
Copied
Hello
I have a little knowledge in javascript,but the algorithms don't scare me.
Where i can find photoshop vairable .
I must do something like this:
For each Layer of group LOGO do
For each layer of group T-SHIRT do
display layer.LOGO(i)
display layer.T-SHIRT(j)
export jpg 80% -> ts + layer.LOGO(i).name + layer.T-SHIRT(j).NAME
hide layer.LOGO(i)
hide layer.T-SHIRT(j)
end for t-shirt
end for LOGO
But i don't know photoshop scripting.
Can you give me the syntax or tell me where I can find it?
Thank you
Copy link to clipboard
Copied
Have you done a Forum search?
https://community.adobe.com/t5/photoshop/export-combination-of-layers/m-p/9997854?page=1#M185811
Copy link to clipboard
Copied
many thanks this code work for me:
displayDialogs = DialogModes.NO
function sTT(v) {return stringIDToTypeID(v)}
runMenuItem(sTT('selectAllLayers'));
(ref = new ActionReference()).putEnumerated
(sTT('layer'), sTT('ordinal'), sTT('targetEnum'));
(lst = new ActionList()).putReference(ref);
(dsc = new ActionDescriptor()).putList(sTT('null'), lst)
executeAction(sTT('hide'), dsc)
runMenuItem(sTT('selectNoLayers')), aD = activeDocument
logoL = (icn = aD.layers[1]).layers.length, icn.visible = true
tshirtL = (ts = aD.layers[2]).layers.length, ts.visible = true
colorL = ( clr = aD.layers[2].layers[0]).layers.length, clr.visible = true
for(aHS = aD.activeHistoryState, i = 0; i < logoL;) {
aD.activeHistoryState = aHS, aD.suspendHistory('', '');
(n1 = (lyr = aD.layers)[1].layers[i++]).visible = true
for(j = 0; j < colorL;) {
(n2 = (c = lyr[2].layers[0].layers[j++])).visible = true;
(sfw = new ExportOptionsSaveForWeb()).JPEG = false
sfw.quality = 80, sfw.format = SaveDocumentType.JPEG
fle = File(aD.path + '/ts-' + n1.name + '-' + n2.name + '.jpg')
aD.exportDocument(fle, ExportType.SAVEFORWEB, sfw)
c.visible = false
}
}
aD.close(SaveOptions.DONOTSAVECHANGES)
But i don't understand
this part
function sTT(v) {return stringIDToTypeID(v)}
runMenuItem(sTT('selectAllLayers'));
(ref = new ActionReference()).putEnumerated
(sTT('layer'), sTT('ordinal'), sTT('targetEnum'));
(lst = new ActionList()).putReference(ref);
(dsc = new ActionDescriptor()).putList(sTT('null'), lst)
executeAction(sTT('hide'), dsc)
runMenuItem(sTT('selectNoLayers')), aD = activeDocument
and why there is false for this line
sfw = new ExportOptionsSaveForWeb()).JPEG = false
This code isn't easy to understand for me because of the synthaxe.
thank you
Copy link to clipboard
Copied
Copy link to clipboard
Copied
With a mockup template its easy to place Logo on a T-Shirt. It would also be easy to change the T-Shirts Color, Fabric, texture etc. However, replacing the T-Shirt would make everything complicated and not easy to do. For T-Shirt are all not the same. They come in may styles and sizes. So where logo can be placed will differ from t-shirt to t-shirt. Where Fabrics will be cut and placed into the t-shirt will change from t-shirt to t-shirt. T-Shirt templates I have seen that can be automatically populated with Photoshop automation seem to be for a fixed T-shirts where component of the T-Shirt are changed with different design elements. If there are different T-shirt they would all be in the template and elements would be changes on each or there would be a template for each T-shirt design. Some Template have multiple views of a T-shirt like a front and back view. I have not seen a template where different designed T-shirts are place on a model and Logo applied to the populated T-Shirt.
A mockup template may be very simple like this one the has two smart object layer that have their object repopulated.
That is populated by running a script that you point to the mockups, to the replacements and to the output folder through the script dialog that may also have other populating options. Smart Object can be populated with different methods. Replace Content requires all replacements to be exactly the same Size Aspect ratio and print resolution as the object in the template. Where any size replacement can be edited into the existing object.
The Script will open the mockup templates and populate them and close them, When processing is done nothing will be open in Photoshop. The script will putout a notification as to how many mockup templates it populated and how mat designs were populated into the mockup templates and how long the process took.
The output folder will contain the jpeg files the script save from the populated mockup templates.
Copy link to clipboard
Copied
There is no shortage of T-shirt Mockup Templates on WWW T-shirt Mockup
Copy link to clipboard
Copied
I believe that these are the droids you are looking for:
https://github.com/mechanicious/photoshopCompositionComposer
Copy link to clipboard
Copied
T shirt change
Copy link to clipboard
Copied
T shirt change
By @Shivam32196084veqi
Care to elaborate?