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

How do I replace smart object with data-driven graphic variable in Photoshop CS6?

New Here ,
Jul 17, 2015 Jul 17, 2015

Copy link to clipboard

Copied

Hi, here's a screenshot of my problem:

http://imgur.com/wLsRbrZ

Basically I can't define the smart object which is the pillow design layer as a graphic variable to apply multiple design picture on it, please help

TOPICS
Actions and scripting

Views

2.7K

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 Expert ,
Jul 17, 2015 Jul 17, 2015

Copy link to clipboard

Copied

A Smart Object layers Pixels can not be altered They are rendered by Photoshop for the smart object.  So you can not use a smart object late as a variable layer.  You would need to replacet the smar object content data-driven graphics does not support that. It just supports replacing text and pixels.

JJMack

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 ,
Jul 17, 2015 Jul 17, 2015

Copy link to clipboard

Copied

This may need a custom 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
New Here ,
Jul 17, 2015 Jul 17, 2015

Copy link to clipboard

Copied

How can I set up a script like that, any suggestion ?

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
Enthusiast ,
Jul 17, 2015 Jul 17, 2015

Copy link to clipboard

Copied

Here is a basic script that will require modification for the type of input files and the output file type.

This example uses jpg for input and save as png

#target photoshop;

app.bringToFront();

main();

function main(){

if(!documents.length) return;

var sourceFolder = Folder.selectDialog( "Please select input folder");

if(sourceFolder == null) return;

var outputFolder = Folder.selectDialog( "Please select output folder");

if(outputFolder == null) return;

var fileList = sourceFolder.getFiles("*.jpg"); //amend to suit

for(var z in fileList){

    activeDocument.activeLayer = activeDocument.artLayers.getByName("pillow design");

    replaceSO(fileList);

    activeDocument.activeLayer.name = "pillow design";

    var Name = decodeURI(fileList.name).replace(/\.[^\.]+$/, '');

    var saveFile = new File(outputFolder + "/Pillow-" + Name + ".png"); //amend ext to suit

    savePNG(saveFile); //amend to suit

    }

};

function savePNG(saveFile){ //amend to suit

    pngSaveOptions = new PNGSaveOptions();

activeDocument.saveAs(saveFile, pngSaveOptions, true, Extension.LOWERCASE);

};

function replaceSO(SO){

var desc = new ActionDescriptor();

desc.putPath( charIDToTypeID( "null" ), new File( SO ) );

executeAction( stringIDToTypeID( "placedLayerReplaceContents" ), desc, 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
New Here ,
Jul 17, 2015 Jul 17, 2015

Copy link to clipboard

Copied

Hi Phillip,

Thank you for your fantastic script, but I encounter the following issue though
http://imgur.com/27UhKqD

After I went to file->script->browse, i chose the script built from Extendscript as a .jsx file, it was asking me to pick the input and output folder, then it happened.
Can you guide me how to fix it please? I feel it's pretty close to what I want to do

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
Enthusiast ,
Jul 17, 2015 Jul 17, 2015

Copy link to clipboard

Copied

That should not happen unless you have put a hyphon between pillow and design as you can see the code does not have the hyphon. That is why is can't find the layer.

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
New Here ,
Jul 18, 2015 Jul 18, 2015

Copy link to clipboard

Copied

Hi Phillip,

I followed your instruction and renamed it to be "pillow", then I realize when I clicked on the smart object, it pops out as "Layer 5121.psb", so the name is essentially different to its respective linked layer which is "pillow".

http://imgur.com/WoL3Fbp

Then I edit it a little bit:

activeDocument.activeLayer = activeDocument.artLayers.getByName("Layer 5121");

It still can't recognize the layer name, how do I proceed ?

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
Enthusiast ,
Jul 24, 2015 Jul 24, 2015

Copy link to clipboard

Copied

Sorry I've been away.

According to your first picture the smart object layer was called "pillow design" and the script is looking for this. There shouldn't need to change anything but the smart object layer for the script to work must be called "pillow design"

It is doing a smart object replace so it souldn't be opening the smart object only replacing it.

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
New Here ,
Jun 26, 2016 Jun 26, 2016

Copy link to clipboard

Copied

Hello Philip Cord and longh79636908  Sorry you open an old thread , but I'm having the same problem and it is not clear if it could resolve ... To me I get the same error.
I do not understand how it should run the script to work. I modified only three lines (can be seen in the catch) . I need to use the Smart Object layer as Pixel Replacement . It can be done with this script? Thank you very much!

Captura05.JPG

Captura06.JPG

Captura07.JPG

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 26, 2016 Jun 26, 2016

Copy link to clipboard

Copied

LATEST

You can not replace a smart object layer object with Photoshop Data Driven Graphics that feature can replace Pixel layers and text layers.  This was pointed out in my first append here. You can see that from your screen capture where you trying to define a variable for the smart object layer named smart. You highlighted there is no replace text or Pixels options. Smart object layers pixels can not be modified. Data driven graphics does not support replace object.  The Associated transform would not work any size replacement.

Replacing a smart Object Layer'd Object requires a Script or the use of Photoshop's UI.  The replacement object must also be the exact same size as the object being replaced.  For every smart object layer has an associated transform.  When you replace the layers object the associated transform is not modified.  For the transform to work correctly the replacement object must be the same size layers original object.

With Data driven graphics when you replace a pixel layer there are sizing and alignment options.

Capture.jpg

The script is not related to Data Driven Graphics and getByName may fail.  The may be something in your document that could be causing a problem. I can not see all the layer in you Document because many groups are contracted.  I saw user having Problems with getByNamet in my search.

https://forums.adobe.com/search.jspa?place=%2Fplaces%2F1383833&q=getbyname

JJMack

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