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

Batch replace smart objects v2

Community Beginner ,
Jan 21, 2019 Jan 21, 2019

Copy link to clipboard

Copied

Greetings,

Unfortunately, my scripting knowledge is very minimal.  In using this script, the script times out and no output files occur.  I am on a pc running Photoshop CC (online subscription, latest update).  It was suggested to me by another forum member to start a new discussion thread here to assist with this problem.

This is what I have:

  •     a mockup file of a canvas wall print with the main single image set as a transformed smart object
  •     a folder of images resized to fit said smart object

This is what I would like a script to do (if possible):

  •     for every image in said folder
  •     replace smart object with images
  •     save each new mockup (one for each new image) as a JPG file.
  •     saved name should be the original image file name (saved in a different directory).  if this naming convention is not possible, its ok as i can rename the files later.

We have over 50k of mockups to do for this particular canvas shape/size....

layers.png

Any suggestions on how I could streamline this process without having to manually replace and save?  THANK YOU!!!

// replace smart object’s content and save psd;

// 2011, use it at your own risk;

#target photoshop

if (app.documents.length > 0) {

var myDocument = app.activeDocument;

var theName= myDocument.name.match(/(.*)\.[^\.]+$/)[1];

var thePath = myDocument.path;

var theLayer = myDocument.activeLayer;

// psd options;

psdOpts = new PhotoshopSaveOptions();

psdOpts.embedColorProfile = true;

psdOpts.alphaChannels = true;

psdOpts.layers = true;

psdOpts.spotColors = true;

// check if layer is smart object;

if (theLayer.kind != "LayerKind.SMARTOBJECT") {alert ("selected layer is not a smart object")}

else {

// select files;

if ($.os.search(/windows/i) != -1) {var theFiles = File.openDialog ("please select files", "*.psd;*.tif;*.jpg", true)}

else {var theFiles = File.openDialog ("please select files", getFiles, true)};

if (theFiles) {

// work through the array;

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

// replace smart object;

                    theLayer = replaceContents (theFiles, theLayer);

                    var theNewName = theFiles.name.match(/(.*)\.[^\.]+$/)[1];

//Raise color picker for Back cover;

try {

app.activeDocument.activeLayer = app.activeDocument.layers[app.activeDocument.layers.length - 1];

// =======================================================

var idsetd = charIDToTypeID( "setd" );

var desc7 = new ActionDescriptor();

var idnull = charIDToTypeID( "null" );

var ref2 = new ActionReference();

var idcontentLayer = stringIDToTypeID( "contentLayer" );

var idOrdn = charIDToTypeID( "Ordn" );

var idTrgt = charIDToTypeID( "Trgt" );

ref2.putEnumerated( idcontentLayer, idOrdn, idTrgt );

desc7.putReference( idnull, ref2 );

var idT = charIDToTypeID( "T   " );

var desc8 = new ActionDescriptor();

var idClr = charIDToTypeID( "Clr " );

var idsolidColorLayer = stringIDToTypeID( "solidColorLayer" );

desc7.putObject( idT, idsolidColorLayer, desc8 );

executeAction( idsetd, desc7, DialogModes.ALL );

} catch (e) {};

//save jpg;

                    myDocument.saveAs((new File(thePath+"/"+theName+"_"+theNewName+".psd")),psdOpts,true);

                    }

          }

}

};

////// get psds, tifs and jpgs from files //////

function getFiles (theFile) {

     if (theFile.name.match(/\.(psd|tif|jpg)$/i) != null || theFile.constructor.name == "Folder") {

          return true

          };

     };

////// replace contents //////

function replaceContents (newFile, theSO) {

app.activeDocument.activeLayer = theSO;

// =======================================================

var idplacedLayerReplaceContents = stringIDToTypeID( "placedLayerReplaceContents" );

    var desc3 = new ActionDescriptor();

    var idnull = charIDToTypeID( "null" );

    desc3.putPath( idnull, new File( newFile ) );

    var idPgNm = charIDToTypeID( "PgNm" );

    desc3.putInteger( idPgNm, 1 );

executeAction( idplacedLayerReplaceContents, desc3, DialogModes.NO );

return app.activeDocument.activeLayer

};
TOPICS
Actions and scripting

Views

27.0K

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

Community Beginner , Jan 22, 2019 Jan 22, 2019

thank you JJMack​ !!

this script is working great now!  Here is the final working script:

// replace smart object’s content and save psd;

// 2011, use it at your own risk;

#target photoshop

if (app.documents.length > 0) {

    var myDocument = app.activeDocument;

    var theName = myDocument.name.match(/(.*)\.[^\.]+$/)[1];

    var thePath = myDocument.path;

    var theLayer = myDocument.activeLayer;

    // psd options;

    psdOpts = new PhotoshopSaveOptions();

    psdOpts.embedColorProfile = true;

    psdOpts

...

Votes

Translate

Translate
Adobe
Community Beginner ,
Jan 22, 2019 Jan 22, 2019

Copy link to clipboard

Copied

thank you JJMack​ !!

this script is working great now!  Here is the final working script:

// replace smart object’s content and save psd;

// 2011, use it at your own risk;

#target photoshop

if (app.documents.length > 0) {

    var myDocument = app.activeDocument;

    var theName = myDocument.name.match(/(.*)\.[^\.]+$/)[1];

    var thePath = myDocument.path;

    var theLayer = myDocument.activeLayer;

    // psd options;

    psdOpts = new PhotoshopSaveOptions();

    psdOpts.embedColorProfile = true;

    psdOpts.alphaChannels = true;

    psdOpts.layers = true;

    psdOpts.spotColors = true;

    // check if layer is smart object;

    if (theLayer.kind != "LayerKind.SMARTOBJECT") {

        alert("selected layer is not a smart object")

    } else {

        // select files;

        if ($.os.search(/windows/i) != -1) {

            var theFiles = File.openDialog("please select files", "*.psd;*.tif;*.jpg", true)

        } else {

            var theFiles = File.openDialog("please select files", getFiles, true)

        };

        if (theFiles) {

            // work through the array;

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

                // replace smart object;

                theLayer = replaceContents(theFiles, theLayer);

                var theNewName = theFiles.name.match(/(.*)\.[^\.]+$/)[1];

                //save jpg;

                var jpegOptions = new JPEGSaveOptions();

                jpegOptions.quality = 10;

                jpegOptions.embedColorProfile = true;

                jpegOptions.matte = MatteType.NONE;

                myDocument.saveAs((new File(thePath + "/" + theNewName + ".jpg")), jpegOptions, true);

            }

        }

    }

};

////// get psds, tifs and jpgs from files //////

function getFiles(theFile) {

    if (theFile.name.match(/\.(psd|tif|jpg)$/i) != null || theFile.constructor.name == "Folder") {

        return true

    };

};

////// replace contents //////

function replaceContents(newFile, theSO) {

    app.activeDocument.activeLayer = theSO;

    // =======================================================

    var idplacedLayerReplaceContents = stringIDToTypeID("placedLayerReplaceContents");

    var desc3 = new ActionDescriptor();

    var idnull = charIDToTypeID("null");

    desc3.putPath(idnull, new File(newFile));

    var idPgNm = charIDToTypeID("PgNm");

    desc3.putInteger(idPgNm, 1);

    executeAction(idplacedLayerReplaceContents, desc3, DialogModes.NO);

    return app.activeDocument.activeLayer

};

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 ,
Jan 22, 2019 Jan 22, 2019

Copy link to clipboard

Copied

I like that you fixed up the script for yourself you ask for help and made the modification need with the little help provided. Good show thank you...

you may want to change

// replace smart object’s content and save psd;

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
New Here ,
Aug 16, 2020 Aug 16, 2020

Copy link to clipboard

Copied

Hi JJMack,

I wanted to say thank you for your set of scripts, they're amazing

Just to let you know, in the 2020 version of photoshop they throw an error at first, if I comment out line 28 (//@include "PCTpreferences.jsx") they run, but I have NO idea what I just turned off.

As well, the buttons in the dialog box don't actually allow me to browse - is this what I commented out? any idea how to get those to work properly?

The script works, but I have to copy and paste in the file locations and names.
Hopefully this helps anyone else who's getting an error with them.

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 ,
Aug 17, 2020 Aug 17, 2020

Copy link to clipboard

Copied

...or it was working seamlessly. For others using the script:
On this new mockup for some reason it now blows up the image going into the smart object by a LOT. Still using the batch replace one object script. Doesnt matter if I choose Fit Image or not. BUT if I click the replace smart object button it does work.
Any idea what may be causing this behaviour?

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 ,
Aug 17, 2020 Aug 17, 2020

Copy link to clipboard

Copied

To use fit image you have to also check edit else replaced content will be used the object will not be edited the replacement will not fitted to the object. You also most likely do not want to use fit the image the edit option will resize the replacement to fill the object. If the replacement has the wrong aspect ratio some image content will be clipped off.   If too much content is clipped off you can also use Fit image no content will be lost however boarders will be introduced on two side of the object.

 

Replacement image for a mockup need to be the same size as the object in the mockup to work properly.  If they are replace content can be used and all will be perfect.   If replacement images are not the correct size. They will not work with replace content they are wrong size, to big,  to small,  wrong aspect ratio who know what replace content will do.   There is where my script come into play if the objects in the Template are Photoshop not placed Camera Raw or AI vector files.  My script can edit the replacement files into the existing template objects.  My script will not edit RAW or Vector Objects the user would  need to change the objects in the mockup to be Photoshop Object or use the correct size replacement and have the script use replace content which it will do by default when edit is not checked.  In Edit is checked replacement will be edited into the existing Photoshop  objects.  RAW and Vector objects will not be updated and the user will be informed of that.

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
New Here ,
Apr 07, 2021 Apr 07, 2021

Copy link to clipboard

Copied

Hi,

 

thanks for sharing your script. It's exactly what I am looking for as I need to create some mockups in batch.

 

Though when opening the Mockup PSD and running the script I get the prompt to select files although the PSD has a smart object layer. When selecting the Mockup PSD again I get the following error message:

 

error.JPG

 

Has anybody here a solution for this? Really would appreciate any hint 🙂

 

Here are the layers of the Mockup PSD:

layers.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 ,
Apr 07, 2021 Apr 07, 2021

Copy link to clipboard

Copied

Do not know which script version you are using. The Mockup you show is not a mockup my script could populated it has a layerset on top of the layer stack. My script only populate Smart object layers on top of the layer stack.  My current Batch mockup Script should give you a message stating there are no smart objects layers on top of the layer stack to populate.  The Mockup template layer stack must be modified  to be to be compatible with my scripts. Downloat the lateste and uset the help button read the template rules created valid templates for my scripts. Free Photoshop Photo Collage and Mockup Toolkit 

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
LEGEND ,
Apr 09, 2021 Apr 09, 2021

Copy link to clipboard

Copied

After your post this thread is bold for me ie unread, though I clicked it many times for last days.

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 Beginner ,
Jan 23, 2019 Jan 23, 2019

Copy link to clipboard

Copied

Found an issue and do not know the solution.

Issue: when selecting more than ~50 image files, the script seems to time out and nothing occurs at all.  very strange.

what could be causing this behavior?

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 ,
Jan 23, 2019 Jan 23, 2019

Copy link to clipboard

Copied

Are you using a PC or  a Mac?

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 Beginner ,
Jan 23, 2019 Jan 23, 2019

Copy link to clipboard

Copied

PC

high end dell laptop

i7, 32BG ram, 1TB hd

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 ,
Jan 23, 2019 Jan 23, 2019

Copy link to clipboard

Copied

I downloaded your script an created a single layered  smart object document and did 70 not problem nos selecter 217 seem to be working

yes 217 no problem

Old Dell workstation

Dual 6 core xeon slow 2ghz

40GB ECC Ram

256GB SSD

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 Beginner ,
Jan 24, 2019 Jan 24, 2019

Copy link to clipboard

Copied

added some alerts to the script (see below)

in running it, i did see the issue occur at ~750 image files.   it did work at 725 image files.

is there a limit setting somewhere?   this is very odd

// replace smart object’s content and save psd;

// 2011, use it at your own risk;

#target photoshop

if (app.documents.length > 0) {

    var myDocument = app.activeDocument;

    try {

        var theName = myDocument.name.match(/(.*)\.[^\.]+$/)[1];

    } catch (e) {

        alert(e);

    }

    var thePath = myDocument.path;

    var theLayer = myDocument.activeLayer;

    // psd options; 

    psdOpts = new PhotoshopSaveOptions();

    psdOpts.embedColorProfile = true;

    psdOpts.alphaChannels = true;

    psdOpts.layers = true;

    psdOpts.spotColors = true;

    // check if layer is smart object; 

    if (theLayer.kind != "LayerKind.SMARTOBJECT") {

        alert("selected layer is not a smart object")

    } else {

        // select files; 

        if ($.os.search(/windows/i) != -1) {

            var theFiles = File.openDialog("please select files", "*.psd;*.tif;*.jpg", true)

        } else {

            var theFiles = File.openDialog("please select files", getFiles, true)

        };

        alert("theFiles.length=" + theFiles.length);

        if (theFiles) {

            // work through the array; 

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

                // replace smart object; 

                alert("try to process file:\n" + theFiles);

                theLayer = replaceContents(theFiles, theLayer);

                var theNewName = theFiles.name.match(/(.*)\.[^\.]+$/)[1];

                //save jpg; 

                var jpegOptions = new JPEGSaveOptions();

                jpegOptions.quality = 10;

                jpegOptions.embedColorProfile = true;

                jpegOptions.matte = MatteType.NONE;

                myDocument.saveAs((new File(thePath + "/" + theNewName + ".jpg")), jpegOptions, true);

            }

        }

    }

};

alert("Done!");

////// get psds, tifs and jpgs from files ////// 

function getFiles(theFile) {

    try {

        if (theFile.name.match(/\.(psd|tif|jpg)$/i) != null || theFile.constructor.name == "Folder") {

            return true

        };

    } catch (e) {

        alert(e);

    }

};

////// replace contents ////// 

function replaceContents(newFile, theSO) {

    try {

        app.activeDocument.activeLayer = theSO;

        // ======================================================= 

        var idplacedLayerReplaceContents = stringIDToTypeID("placedLayerReplaceContents");

        var desc3 = new ActionDescriptor();

        var idnull = charIDToTypeID("null");

        desc3.putPath(idnull, new File(newFile));

        var idPgNm = charIDToTypeID("PgNm");

        desc3.putInteger(idPgNm, 1);

        executeAction(idplacedLayerReplaceContents, desc3, DialogModes.NO);

        return app.activeDocument.activeLayer

    } catch (e) {

        alert(e);

    }

};

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 ,
Jan 24, 2019 Jan 24, 2019

Copy link to clipboard

Copied

mpspringer  wrote

added some alerts to the script (see below)

in running it, i did see the issue occur at ~750 image files.

What was "THE ISSUE" 

How big are your image.  I did notice the RAM usage keep climbing. I do not understand Why There is only one document that has one Smart Object replaced many times.   I just ran a 876 batch RAM usage climb from 4GB to 19GB slowly but steadily.  I did comment out the save to the output files were never written. However the object was replace 876 time and too my slow machine over ten minutes 

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
New Here ,
Oct 02, 2019 Oct 02, 2019

Copy link to clipboard

Copied

I am using a similar script to the one discussed in this thread and it works perfectly, except I cannot batch process more than about 3500 files at a time due to the windows command 8,191 character limit. So this means that when I have a folder with 50,000 images that I want to run a smart object replace on, I have to babysit the process and run them in batches of 3,500 at a time until the job is done. Just wondering if anyone is aware of a workaround for this issue. I saw some posts online that suggested an open source replacement for the windows cmd.exe file that would remove the character limit but I don't really understand it very well (due to my relative computer/programming illiteracy) and I don't know if this is a viable solution. If anyone is aware of a workaround for this, I would be really grateful to hear about it. Thanks!

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
Explorer ,
Nov 11, 2019 Nov 11, 2019

Copy link to clipboard

Copied

There is now an extension at Adobe Exchange for batch replacement of one or more smart layers with comp layer support:

Pixelsplasher Batch Smart Layer Replace 

This extension can replace multiple smart layers at every export and can auto-fit the replaced image to the original dimension of the replaced smart layer so there is no need to resize the source images.

FEATUREShttps://www.pixelsplasher.com/_downloads/scripts/batch-replace-smart-layer-content-script-for-adobe-...

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 Beginner ,
Nov 11, 2019 Nov 11, 2019

Copy link to clipboard

Copied

Yeah. I've seen this extension so many months ago. But I can't afford 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 ,
Feb 12, 2020 Feb 12, 2020

Copy link to clipboard

Copied

hello, I have tried to use your script with a bit of modification, It's just about the import files' format, I change them to .png. But it didn't work at all, it always says "Error 21: undefined is not an object", there is an issues with line 55 "var theNewName = theFiles.name.match(/(.*)\.[^\.]+$/)[1]". Any help please?

 

There is the script I used:

#target photoshop

if (app.documents.length > 0) {

var myDocument = app.activeDocument;

var theName = myDocument.name.match(/(.*)\.[^\.]+$/)[1];

var thePath = myDocument.path;

var theLayer = myDocument.activeLayer;

// psd options;

psdOpts = new PhotoshopSaveOptions();

psdOpts.embedColorProfile = true;

psdOpts.alphaChannels = true;

psdOpts.layers = true;

psdOpts.spotColors = true;

// check if layer is smart object;

if (theLayer.kind != "LayerKind.SMARTOBJECT") {

alert("selected layer is not a smart object")

} else {

// select files;

if ($.os.search(/windows/i) != -1) {

var theFiles = File.openDialog("please select files", "*.png", true)

} else {

var theFiles = File.openDialog("please select files", getFiles, true)

};

if (theFiles) {

// work through the array;

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

// replace smart object;

theLayer = replaceContents(theFiles, theLayer);

var theNewName = theFiles.name.match(/(.*)\.[^\.]+$/)[1];

//save jpg;

var jpegOptions = new JPEGSaveOptions();

jpegOptions.quality = 10;

jpegOptions.embedColorProfile = true;

jpegOptions.matte = MatteType.NONE;

myDocument.saveAs((new File(thePath + "/" + theNewName + ".jpg")), jpegOptions, true);

}

}

}

};

////// get psds, tifs and jpgs from files //////

function getFiles(theFile) {

if (theFile.name.match(/\.(png)$/i) != null || theFile.constructor.name == "Folder") {

return true

};

};

////// replace contents //////

function replaceContents(newFile, theSO) {

app.activeDocument.activeLayer = theSO;

// =======================================================

var idplacedLayerReplaceContents = stringIDToTypeID("placedLayerReplaceContents");

var desc3 = new ActionDescriptor();

var idnull = charIDToTypeID("null");

desc3.putPath(idnull, new File(newFile));

var idPgNm = charIDToTypeID("PgNm");

desc3.putInteger(idPgNm, 1);

executeAction(idplacedLayerReplaceContents, desc3, DialogModes.NO);

return app.activeDocument.activeLayer

};

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 ,
Feb 12, 2020 Feb 12, 2020

Copy link to clipboard

Copied

I would suggest the you find a better script.  To me it look like the code in the script is bad.   The for loop looks like its is processing a file list.   Which you created by selecting some number of files in a file open dialog that allows more then one file to be selected..  The File List is stored in an Array named "theFiles". The loop is control using the var m which is initialized to 0 for the first array element,  and is incremented  with "m++" at the end of an interaction of the loop. When "m" becomes equal to the number of the array elements "theFiles.length" the loop ends.   In  for loop you should see that an array element is being processed "theFiles[m]".   That code is not in there.  The first png file may be repeatedly replaced the mockup objecy  the the jpeg file repeatedly saved over. Or the line "var theNewName = theFiles.name.match(/(.*)\.[^\.]+$/)[1];" may simly fail because "theFiles" is not a file object. 

 

The script also uses Photoshop smart object layer feature Replace Content.  Which mean all replacement object need to be the Sand Aspect Ratio, Size and Print resolution of the object in the mockup template.   The mat bet as Problem with the Object in the mockuo template if you Placed in a PNG creating the template.  Place may have trimmed transparent boarders if the png file had any.  When  ever I create Png files that I may place onto document I will insure the top left and bottom right document pixels and not empty  that they have at least a 1% opacity gray pixel the png will not have ant transparent borders.

 

You may want to look at the Batch Mockup Scripts I have added to  package Free Photoshop Photo Collage and Mockup Toolkit  The scripts use replace content by default but have an edit option thar edit the objects rather the use replace content. Replacemebt images can be any size.

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 Beginner ,
Apr 25, 2020 Apr 25, 2020

Copy link to clipboard

Copied

Could you please check this mockup?

https://drive.google.com/file/d/13eMjgWSvlidhpyopm2n56IHyPWirpRDB/view?usp=sharing

it gives me error "selected object is not a smart object"

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 25, 2020 Apr 25, 2020

Copy link to clipboard

Copied

How do you intend to user that As a template.  Most Template have a Smart Object layer that has a design to be replaced. Or a  Layer that is changed that is clipped or masked by and overlay. The template you posted has a 3D object that need its surface material replaced. You would to develop a method to do that and be careful not to touch the 3d object position are all because the are overlays in the document.  I have not see any automated Script or actions to do something like that and  I do not know how one would.   For myself I have made a template for a couple of 3D objects surface materials a Photo Collage template. That I populate and tham edited into 3D layers that has a Video timeline to animated the object. There are no overlays in the document layers. Overlays would need to be within the 3D scene and be animated as well not be is some other dimension in the documents layers.

SoccerBall300.gifBallCollage3-400.gif

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 Beginner ,
Apr 25, 2020 Apr 25, 2020

Copy link to clipboard

Copied

Thank you for your reply!

I thought the script that posted in this article would help me to batch import the design image into this mockup template then export as jpg or png format images.

微信截图_20200425193442.png微信截图_20200425193425.png

now I understand that replaceable object is a 3D object instead of a smart object.

 

So, is the script able to batch import and replace the design images from a folder and export all the finished image to another folder?

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
Explorer ,
Apr 25, 2020 Apr 25, 2020

Copy link to clipboard

Copied

If you need to auto-replace, auto-transform and auto-export to JPG or PNG the smart layers that are on a 3D Layer object, the 3D Layer Add-on for Batch Smart Layer Replace script can help you. It is not free, however, but can save you a lot of time.

 

Here is a video demo of 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
Community Beginner ,
Apr 25, 2020 Apr 25, 2020

Copy link to clipboard

Copied

Amazing! Thank 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
Community Expert ,
Apr 25, 2020 Apr 25, 2020

Copy link to clipboard

Copied

I think you would need to read more about what the extension does. The example look like a simple cylinder that may take a simple rectangle image that has a particular aspect ratio as a replacing label. That would not be the case for a 3D Object like a soccer ball.  the surface UV would be more complex than a simple rectangle.  The video also look doctored to me for it showed replacement label thumbnail that where for various aspect ratio jpeg images some of which had transparent backgrounds where jpeg file formats does not support transparency.

image.png

 

In the video it look like it may be a script the was added to the menu File>Export>Some Name.  That you need to have the Template document open in Photoshop Target the 3d Layer then run the script that has an interactive dialog where you need toe select the 3D Layer's Object texture you want to be replaced from a selection list. Then navigate to a folder with replacement content.   The video showed the above thumbnail which would not be the correct size for a good replacement of content for all possible 3D Objects. The script would need to edit these replacement jpeg images for the 3D object surface.  I would not know how a script could edits any size jpeg imget to fit on any 3D object surface.   I do not do 3D work. I have only played a little with Photoshop 3D feature.  To be honest its too complex for my little mind it is like work.  I'm retired and don't have the time for work.  So The add-on could only used for a template the only need one surface replace for the script seems to replace the surface. Save an Output file and repeat that process  for all the replacement jpegs selected for the template.

 

For example for my 3D soccer ball the surface replacement would need to look like this.  Shown without the UV overlays and withe the UV Overlays. The script would also need to save out  MP4 or Animated Gif for this template.  All I automated was the creation of replacement surface.

Capture.jpg

 

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