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!
Copy link to clipboard
Copied
Take a closer look at this thread - maybe it helps...
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?
Copy link to clipboard
Copied
Did you read the thread completely and make any changes?
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,
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!
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Have a look at this script here https://www.allievi-photography.com/batch-mockup-photoshop-script/