• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Define patterns for all layers

Participant ,
Jun 05, 2017 Jun 05, 2017

Copy link to clipboard

Copied

How do I create a script that saves each layer in my Photoshop file as a pattern (ie. define pattern for each layer, keeping the layer name for the pattern name)?

TOPICS
Actions and scripting

Views

1.4K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Participant , Apr 17, 2021 Apr 17, 2021

I should have replied much earlier ... (1) Saved a script to create a pattern from an image, giving the pattern name the same name as the document name.  (2) Created an action to run the pattern script on an image, and close the image. (3) Used Batch to run the action on a folder of image files. After this, the patterns were all available in my Photoshop Patterns tab, named as per the original file name.

Votes

Translate

Translate
Adobe
Community Expert ,
Jun 05, 2017 Jun 05, 2017

Copy link to clipboard

Copied

The function given in this thread

Re: Creating a photoshop action to save a batch of images as patterns

should help you.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jun 06, 2017 Jun 06, 2017

Copy link to clipboard

Copied

Hi, I tried that script, and while it's useful for saving a single image as a pattern, it does not save all the layers in the photoshop file as a pattern (only the top-most layer in view, or whatever is showing on the screen currently).

Is there any way to save each layer, as an individual pattern (for all layers that are in a single Photoshop document)? So if I have 8 layers in the Photoshop file (each taking up the entire canvas), I want to define 8 corresponding patterns.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 06, 2017 Jun 06, 2017

Copy link to clipboard

Copied

You have to customise the Script naturally, but there are Scripts available for assessing the Layers in a File that you can modify.

Re: Layer Sets (groups)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 17, 2021 Apr 17, 2021

Copy link to clipboard

Copied

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 18, 2021 Apr 18, 2021

Copy link to clipboard

Copied

Thanks for the functioning link, @Kukurykus .

Strangely I hadn’t been notified of the recent action on this thread.  

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 18, 2021 Apr 18, 2021

Copy link to clipboard

Copied

LATEST

I'm glad you used name of that thread otherwise we couldn't find it anymore on forum.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Apr 17, 2021 Apr 17, 2021

Copy link to clipboard

Copied

I should have replied much earlier ... (1) Saved a script to create a pattern from an image, giving the pattern name the same name as the document name.  (2) Created an action to run the pattern script on an image, and close the image. (3) Used Batch to run the action on a folder of image files. After this, the patterns were all available in my Photoshop Patterns tab, named as per the original file name.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Apr 17, 2021 Apr 17, 2021

Copy link to clipboard

Copied

Ps. To clarify the above answer, I gave up saving each layer as a pattern. Rather, I saved each layer as an individual image in a folder, then used that folder location in the batch for the pattern making script.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 17, 2021 Apr 17, 2021

Copy link to clipboard

Copied

Was not that what you needed: Jun 6, 2017

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 17, 2021 Apr 17, 2021

Copy link to clipboard

Copied

quote

I(...)will get back onto it when I can.(...)I am a beginner, so I might take a while to sort it out


By @CatoPbx almost 4 years ago   

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Apr 18, 2021 Apr 18, 2021

Copy link to clipboard

Copied

I somehow missed that script. I will try it out when I next want to make patterns fron layers.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 18, 2021 Apr 18, 2021

Copy link to clipboard

Copied

It's better seen to first try someone's attempt, than later leave own solution to mark is as correct.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 17, 2021 Apr 17, 2021

Copy link to clipboard

Copied

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 06, 2017 Jun 06, 2017

Copy link to clipboard

Copied

Have you been able to amend/combine the Scripts according to your needs?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jun 06, 2017 Jun 06, 2017

Copy link to clipboard

Copied

Hi, I needed to do something else, so will get back onto it when I can. Thanks for the advice, I am a beginner, so I might take a while to sort it out - but will let you know.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 06, 2017 Jun 06, 2017

Copy link to clipboard

Copied

You could give this a try:

// create patterns from layers;

// 2017, use it at your own risk;

#target photoshop

var theLayers = collectLayers(app.activeDocument, []);

// hide layers;

for (var n = 0; n < theLayers.length; n++) {theLayers.visible = false};

// create patterns;

for (var m = 0; m < theLayers.length; m++) {

theLayers.visible = true;

createPattern(theLayers.name)

theLayers.visible = false;

};

////// function collect all layers //////

function collectLayers (theParent, allLayers) {

if (!allLayers) {var allLayers = new Array}  

else {};

for (var m = theParent.layers.length - 1; m >= 0;m--) {

var theLayer = theParent.layers;

// apply the function to layersets;

if (theLayer.typename == "ArtLayer") {

allLayers.push(theLayer);

else { 

allLayers = (collectLayers(theLayer, allLayers))

// this line includes the layer groups;

//allLayers.push(theLayer);

}

};

return allLayers

};

////// pattern //////

function createPattern(theName) {

    var desc6 = new ActionDescriptor();

        var ref3 = new ActionReference();

        ref3.putClass( charIDToTypeID('Ptrn') );

    desc6.putReference( charIDToTypeID('null'), ref3 );

        var ref4 = new ActionReference();

        ref4.putProperty( charIDToTypeID('Prpr'), charIDToTypeID('fsel') );

        ref4.putEnumerated( charIDToTypeID('Dcmn'), charIDToTypeID('Ordn'), charIDToTypeID('Trgt') );

    desc6.putReference( charIDToTypeID('Usng'), ref4 );

    desc6.putString( charIDToTypeID('Nm  '), theName );

    executeAction( charIDToTypeID('Mk  '), desc6, DialogModes.NO );

};

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines