Photoshop Script for Multiple Mockups

New Here ,
Nov 08, 2018 Nov 08, 2018

Copy link to clipboard

Copied

Hi there,

I have a psd mockup that contains one smart object, I'm looking to replace the contents of that smart object with approx 100 different pngs and then export those all as individual jpgs. For context the smart object is a picture frame that I am putting different prints into.

I found this discussion but I have no experience with script creating and am not sure if this is the answer I'm looking for (this one looks to be for 1 photo into multiple mockup psds whereas I have 1 mockup psd and 100 different pngs to place) RePlace My Design In All Mockups SmartObjects

What I have currently been doing is placing embedded files (the pngs) into the smart object, saving that, and then exporting the mockup psd as a jpg one by one which is very time consuming.

Does anyone have any suggestions on how I can optimize the process? Thanks in advance!

TOPICS
Actions and scripting

Views

6.9K

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
Advocate ,
Nov 09, 2018 Nov 09, 2018

Copy link to clipboard

Copied

Take a closer look at this thread - maybe it helps...

Batch replace smart objects in mockup file

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 ,
Nov 11, 2018 Nov 11, 2018

Copy link to clipboard

Copied

That did help a bit, thanks!

I used the script given - it exports the first file it uses properly and then only exports the same one for all the files that come after it. The script asks if you want to save changes before closing the smart object file and no matter which I choose, save or don't save, it will still only export the first image. Do you know why this happens?

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
Advocate ,
Nov 11, 2018 Nov 11, 2018

Copy link to clipboard

Copied

Did you read the thread completely and make any changes?

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
LEGEND ,
Nov 12, 2018 Nov 12, 2018

Copy link to clipboard

Copied

Are you sure you using the script posted on the thread?  In the code I see for look in line 24  it edits the smart object layed object by opening in line 27 the in line 30 places ine the next file from the source image folder, and then scale the new smart object layer to fit the canvsa on line 31. Line 32 hides all other layer in the Object work file and line 34 Closes and saves the changed  wile will cause Photoshop to Updated the smart obhect layer inet your mocu toe containe the pmg image.  Line 36 than save you mockup Document as Jpeg file, With your imege populated.  Then the Mockup Document is reverted in history to its open state.  

The for loop does this process for all your source image files.   In the Loop I see two  file save  Close(saveChanges) and Save as jpeg.

I think what may be happening is the  "smartObject.close(SaveOptions.SAVECHANGES);"  May be switching from Save to Save As because the original  was a flat png file and not there are layers.   To test this out open your mockup PSD file in Photoshop. Then open the smart objects layer object and if the work file is a flat png file.  It is likely your problem.  Add an empty layer and the use save as. You will get a warning message click ok and the do a second as and save it to your desktop as a psd. Close the work document.  In Mockup Document this time use Layer>Smart Object>Replace Contents... and replace it with the PSD file you just saved to your desktop. Save your mockup PSD file.  The script may now work for the object is now a layered file,

JJMack

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 ,
Nov 12, 2018 Nov 12, 2018

Copy link to clipboard

Copied

I think you were right it had something to do with the PNG. I deleted the smart object and made a new one and now it works. Thanks for your help JJMack and Tom Winkelmann, I really appreciate your time!

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 ,
Apr 09, 2022 Apr 09, 2022

Copy link to clipboard

Copied

LATEST

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