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

Batch replace smart objects in mockup file

Community Beginner ,
Feb 10, 2018 Feb 10, 2018

Hi there,

I want to know if it's possible to import x-number of png images into a mockup template with a smart object and then all saved in jpgs? The following script is not working for me but it's probably close to what I need:

Batch replace smart objects

The script must do the following:

Search in folder for PNG files

Place the PNG image into the Smart Object (top center)

Save file as JPG into the source folder with the same name as the source file

For example:

Before the script

\Images\Image 1\PNG\Design1.png

\Images\Image 2\PNG\Design2.png

\Images\Image 3\PNG\Design3.png

\Images\Image 4\PNG\Design4.png

After the script

\Images\Image 1\PNG\Design1.png

\Images\Image 1\PNG\Mockup.jpg

\Images\Image 2\PNG\Design2.png

\Images\Image 2\PNG\Mockup.jpg

\Images\Image 3\PNG\Design3.png

\Images\Image 3\PNG\Mockup.jpg

\Images\Image 4\PNG\Design4.png

\Images\Image 4\PNG\Mockup.jpg

I hope this makes sense. I will appreciate if someone can give me an advise what is the best way to do that.

Kind regards,

Katt

TOPICS
Actions and scripting
16.6K
Translate
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 Beginner ,
Feb 23, 2018 Feb 23, 2018

I have to do a batch of 500 PNGs with 5 different mockups so I have 15 into one mockup from where I got the pixels in every corner and I try script with a different mockup.

Translate
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 ,
Feb 23, 2018 Feb 23, 2018

Which part of the script I have to delete to get those PNGs simply imported into the SO? I don't need them scaled, positioned, centered, nothing... I tried so many variation of the script but nothing seems to work. The script does weird things!

Translate
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 23, 2018 Feb 23, 2018

The Script in the thread you mentioned in your original post contains the function replaceContents that you can use.

Translate
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 23, 2018 Feb 23, 2018

Do all the smart object layers you want to update in these mockup have the same size objects?   I would think the two pixels would preserve the transparent borders and that c.pfaffenbichler script resize would work well and no realignment would be needed as long as all object and pngs have the same aspect ratio.  However I have not looked at any of the script updates he made for you.

I know I have problems placing in  PNG when a png has transparent border(s).

I do not like replacing he content of smart objects layers because all replacement object need to be exactly the same size and resolution.  So that the smart object layers associated transform that are not replaced work correctly.  A smart object may also have more than one transform for the may be other smart object layers that share the same object.  Often used in mockups.

His script does not replace the smart object layers content.  Instead his script  updated the smart object layer by opening its object in Photoshop edits and commits the changes so Photoshop will update the smart objects layer.   I would think with this approach PNG with transparent border(s) would still be a problem and replacements with a different aspect ratios would have positioning problems. All Smart Object Layers that share the object would be affected.

Can you post  one of you png the you add the two 1% opaque pixels to.

JJMack
Translate
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 23, 2018 Feb 23, 2018

Because you seem to have a T-shirt mock and would want to have designs placed in in different locations for the T-shirts,   I think the best approach would be to Replace  the smart object layers content.  All replacements would have the same size and resolution.  Their canvas would be transparent have a layer with 1% opaque pixels in the corners.  And a Logo or design Place in sized and positioned over the transparent canvas then save out as pngs with the pixels in the corners to preserve the transparent canvas borders....

JJMack
Translate
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 ,
Feb 16, 2018 Feb 16, 2018
Translate
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