Skip to main content
Known Participant
June 22, 2013
Question

How to replace a Smart object content with folder of JPGs

  • June 22, 2013
  • 2 replies
  • 4832 views

Greetings!

Sorry if that title is not clear. I have a cover design template (see example). The image is a transformed Smart Object. I want to streamline my workflow.

Say I have a folder of jpgs, and need to replace the smart object of the template with the new cover jpg, then save for web as a JPG comp. Repeat.

I already have a nice "scale layer to current canvas size" script from Michael L Hale. Which would be necessary in case the jpg is larger or smaller than the Smart object's content it will replace.

Any thoughts if this could be done?

Michael's resize script is here: http://forums.adobe.com/thread/1233856

Thanks

Maxi

This topic has been closed for replies.

2 replies

JJMack
Community Expert
Community Expert
June 23, 2013

Remember in that other tread I wrote you would need to take aspect ratio into account if you don't want distortion. You do not want distortion placing in images.   You also do not want to place in all image in canvas size.  If your images vary in size you do not want to replace the contents of a smart object layer for the smart object associated transform to work correctly you need the replace the embedded object with an object with exactly the same size of the original embedded object.

Also in that other thread I gave you code from one of my Photoshop Photo Collage Toolkit.  You seem to be creating a collage. You man want to look at my Photo Collage Toolkit.

Templates are very easy to create for my Toolkit's scripts to work, You just need to follow four simple easy rules.

The Four Rules:

  1. Size the photo collage templates for the print size you want - width, height and print DPI resolution.
  2. Photo collage templates must have a Photoshop background layer. The contents of this layer can be anything.
  3. Photo collage templates must have alpha channels named "Image 1", "Image 2", ... "Image n".
  4. Photo collage templates layers above the background layers must provide transparent areas to let the images that will be placed below them show through.

So your template would be easy and look like this, Red rectangle outlines my scripts.

You would then use one of the scripts like interactive popopulate select the template then hit create collage

The script would the open the template copy it the go to full screen show you a cyan mask as to where the next image will be placed, And put you into an interactive select image dialog.

Once you select the script will place in the image resize and position it the put you in an interactive transform so you can tweak the position and size. The Populated collage will remain open in Photoshop.

Documentation and Examples

JJMack
Known Participant
June 23, 2013

Wow again!

I will use your Photoshop Photo Collage Toolkit. Generally my specs are for a 6x9 cover. I usually save off 1200 pixel x... JPGs to sent to my client. Ocassionally the aspect ratios are not exact.

So when I open the smart object. I paste in or copy the new cover on top of the previous cover. In that case I must match the aspect ratio, or the edges will show in the primary template. (So that resize script is perfect!)

But since the SO has already been transformed. skewed, even warped to fit the cover. So the aspect ratio issues ere not critical. As long as it fits x and y.

I have been trying to offer more value. So, I have been creating these "Collages" so to speak, manually. So, if I can get this workflow working properly, I can run through a dozen design options and present a really nice package.

Thanks again for sharing your expert knowlege.

I'll start playing with your toolkit.

Best

Maxi!

June 23, 2013

o when I open the smart object. I paste in or copy the new cover on top of the previous cover. In that case I must match the aspect ratio, or the edges will show in the primary template. (So that resize script is perfect!)

Inspiring
June 22, 2013

You can use Action Manager to replace the contents of a smart object

function replaceLayer(fileRef){

//replaces the contents of the smart object on the activeLayer

  try {

        var desc = new ActionDescriptor();

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

        executeAction( stringIDToTypeID( "placedLayerReplaceContents" ), desc, DialogModes.NO );

      } catch (e) {}

  }

};

You can edit the contents of a smart object with this line

executeAction( stringIDToTypeID( "placedLayerEditContents" ), new ActionDescriptor(), DialogModes.NO );

What I would do is have a loop that for each jpg file it replaces the template smart object then opens it for editing. Once open check size and resize if needed, Save/close the SO, SaveAs the template.

Known Participant
June 22, 2013

Hello again!

Thank you.

I will play with that script.

Max:-)