Welcome Dialog

Welcome to the Community!

We have a brand new look! Take a tour with us and explore the latest updates on Adobe Support Community.


Create Actions to Automatically Export Images

Community Beginner ,
Jul 27, 2021 Jul 27, 2021

Copy link to clipboard

Copied

Hi Guys!
I'm currently creating the pictures for my online-shop for clothes.

I've 10 pictures of my Standard T-Shirt (each a different color).
I've imported them into PHOTOSHOP (each on a different layer).
I've imported my design (also on a different layer).

Now I want to automatically export the 10 pictures for the Standard T-Shirt with the design on it.
If possible I would like to automatically name each of the 10 files (with the correct color name).

I've probaly watched every YouTube-Video & read articles on 3 forums ragrding PHOTOSHOP, but haven't found what I'm searching for. I only know, that Actions can be created, but that's it. No specific instructions. Can anybody please help me? 😞

TOPICS
Actions and scripting, Windows

Views

126

Likes

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

Adobe Community Professional , Jul 27, 2021 Jul 27, 2021
The following script may be an answer: photoshopCompositionComposer The raw code is here, ready for a select all: photoshopCompositionComposer-v0.1.jsx Copy the code text to the clipboard Open a new blank file in a plain-text editor (not word-processor) Paste the code in Save the text file as .txt Rename the text .txt to .jsx Install or browse to the .jsx file to run More detailed instructions here: Downloading and Installing Adobe Scripts Good luck!

Likes

Translate

Translate
Adobe Community Professional ,
Jul 27, 2021 Jul 27, 2021

Copy link to clipboard

Copied

The following script may be an answer:

photoshopCompositionComposer

 

The raw code is here, ready for a select all:

photoshopCompositionComposer-v0.1.jsx

 

  1. Copy the code text to the clipboard
  2. Open a new blank file in a plain-text editor (not word-processor)
  3. Paste the code in
  4. Save the text file as .txt
  5. Rename the text .txt to .jsx
  6. Install or browse to the .jsx file to run

 

More detailed instructions here:

Downloading and Installing Adobe Scripts

 

Good luck!

 

Likes

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
New Here ,
Aug 29, 2021 Aug 29, 2021

Copy link to clipboard

Copied

when i run this script i m getting this error.. pls help bro...

 

Even i have follow the same layer style as mention here:

photoshopCompositionComposer

Likes

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
Adobe Community Professional ,
Aug 29, 2021 Aug 29, 2021

Copy link to clipboard

Copied

I'd need to take a look at the psd.

 

Also consider an alternative script:

 

Layer Saver.jsx

Likes

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 Beginner ,
Sep 01, 2021 Sep 01, 2021

Copy link to clipboard

Copied

Thank You so much up to this point, Stephen!

It works perfectly... apart from:
I want to export .jpg-files instead of .png-files.
I've already browsed the web, couldn't find an answer though.

Do you now it?

Best Wishes!

Likes

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
Adobe Community Professional ,
Sep 01, 2021 Sep 01, 2021

Copy link to clipboard

Copied

Also consider an alternative script:

 

Layer Saver.jsx

 

You could also use a batch action or Image Processor or Image Processor Pro to batch convert to JPEG from the standard PNG/PSD output offered by this script.

 

Likes

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 Beginner ,
Sep 01, 2021 Sep 01, 2021

Copy link to clipboard

Copied

Thank You so much up to this point, Stephen!

It works perfectly... apart from:
I want to export .jpg-files instead of .png-files.
I've already browsed the web, couldn't find an answer though.

Do you now it?

Best Wishes..!

Likes

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
Adobe Community Professional ,
Sep 01, 2021 Sep 01, 2021

Copy link to clipboard

Copied

The script code would need to be modified to create a JPG rather than a PNG.

 

EDIT: Try this, currently set to JPEG quality level 10...

 

/* 
https://github.com/mechanicious/photoshopCompositionComposer 

photoshopCompositionComposer-JPEG.jsx
Modified by Stephen Marsh, 2nd September 2021
*/

var userDisplayDialogsPref = app.displayDialogs;

app.displayDialogs = DialogModes.ALL;

var savePath;

app.displayDialogs = DialogModes.NO;

function getType(thing){
    if(thing === null) return "[object Null]"; // special case
    return Object.prototype.toString.call(thing);
}

function getCombinations(arr, n) {
  if (n == 1) {
      var ret = [];
      for (var i = 0; i < arr.length; i++) {
          for (var j = 0; j < arr[i].length; j++) {
              ret.push([arr[i][j]]);
          }
      }
      return ret;
  } else {
      var ret = [];
      for (var i = 0; i < arr.length; i++) {
          var elem = arr.shift();
          for (var j = 0; j < elem.length; j++) {
              var childperm = getCombinations(arr.slice(), n - 1);
              for (var k = 0; k < childperm.length; k++) {
                  ret.push([elem[j]].concat(childperm[k]));
              }
          }
      }
      return ret;
  }
}

function showAllArtLayers() {
  for(var i = 0; i < layerSets.length; i++) {
    for(var z = 0; z < layerSets[i].artLayers.length; z++) {
      layerSets[i].artLayers[z].visible = true;
    }
  }
}

function hideAllArtLayers() {
  var layerSets = app.activeDocument.layerSets;

  for(var i = 0; i < layerSets.length; i++) {
    if(layerSets[i].artLayers.length) {
      for(var z = 0; z < layerSets[i].artLayers.length; z++) {
        layerSets[i].artLayers[z].visible = false;
      }
    } else {
      for(var z = 0; z < layerSets[i].layerSets.length; z++) {
        layerSets[i].layerSets[z].visible = false;
      }
    }
  }
}

function getArtLayerCollectionCollection() {
  var layerSets = app.activeDocument.layerSets,
      artLayerCollectionCollection = [];

  for(var i = 0; i < layerSets.length; i++) {
    var artlayerCollection = [];
    if(layerSets[i].artLayers.length) {
      for(var z = 0; z < layerSets[i].artLayers.length; z++) {
        if(layerSets[i].name.indexOf('__') !== 0)
          artlayerCollection.push(layerSets[i].artLayers[z]);
      }
    } else {
      for(var z = 0; z < layerSets[i].layerSets.length; z++) {
        if(layerSets[i].name.indexOf('__') !== 0)
          artlayerCollection.push(layerSets[i].layerSets[z]);
      }
    }
    artLayerCollectionCollection.push(artlayerCollection);
  }

  return artLayerCollectionCollection;
}

function combine() {
  var artLayerCollectionCollection = getArtLayerCollectionCollection(),
      artLayerCollectionCollectionCombinations = getCombinations(artLayerCollectionCollection, getLayerSetsCount()),
      continueConfirmation;

      if(! artLayerCollectionCollectionCombinations.length) return alert('Script has aborted. No combinations found. Please make sure no empty groups are present.');

      continueConfirmation = confirm(artLayerCollectionCollectionCombinations.length + " combinations found. Would you like to continue?");

      if(! continueConfirmation ) return alert('Script has been aborted.');

      savePath = Folder.selectDialog("Select an output folder");

      var includePSDFiles = confirm('Would you like to include corresponding PSD documents with the JPEG versions?')

      for(var i = 0; i < artLayerCollectionCollectionCombinations.length; i++) {
        hideAllArtLayers();
        var artLayerNames = [];
        for(var z = 0; z < artLayerCollectionCollectionCombinations[i].length; z++) {
          var artLayer = artLayerCollectionCollectionCombinations[i][z];
          artLayer.visible = true;
          artLayerNames.push(artLayer.parent.name);
          artLayerNames.push(artLayer.name);
        }
        saveDocumentAsJPEG(savePath + '/' + normalizeSaveFileName(artLayerNames.join('')).substr(0, 254));
        if(includePSDFiles) saveDocumentAsPSD(savePath + '/' + normalizeSaveFileName(artLayer.parent.name + artLayerNames.join('')).substr(0, 254));
      }
}

function getSmallestLayerSetCount() {
  var count = null,
  layerSets = app.activeDocument.layerSets;

  for(var i = 0; i < layerSets.length; i++) {
    var artLayers = layerSets[i].artLayers;

    if(count === null) count =  artLayers.length;

    if(artLayers.length < count) count = artLayers.length;
  }

  return 1;
}

function getLayerSetsCount() {
  var layerSets = app.activeDocument.layerSets,
      count = 0;

  for(var i = 0; i < layerSets.length; i++) {
    if(layerSets[i].name.indexOf('__') !== 0) count++;
  }

  return count;
}

function normalizeSaveFileName(name) {
  return name;
}

function saveDocumentAsJPEG(path) {
    app.activeDocument.saveAs(new File(path), new JPEGSaveOptions(), JPEGSaveOptions.quality = 10);
}

function saveDocumentAsPSD(path) {
  app.activeDocument.saveAs(new File(path), new PhotoshopSaveOptions());
}

combine();

app.displayDialogs = userDisplayDialogsPref;

 

 

 

Likes

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
Adobe Community Professional ,
Sep 01, 2021 Sep 01, 2021

Copy link to clipboard

Copied

I have previously modified this script to use JPEG and change the default naming produced by the script:

 

Saving multiple files into same folder from actions

 

 

Likes

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 Beginner ,
Sep 02, 2021 Sep 02, 2021

Copy link to clipboard

Copied

You're the best, Stephen! 🙂

It works perfectly!

You've just saved me a lot of time.

All the best to You!

Likes

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
Adobe Community Professional ,
Sep 02, 2021 Sep 02, 2021

Copy link to clipboard

Copied

Your welcome!

Likes

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
Adobe Community Professional ,
Sep 02, 2021 Sep 02, 2021

Copy link to clipboard

Copied

LATEST

.slice() can be removed. Now I see also getType function, so probably more stuff too.

Likes

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