Skip to main content
Known Participant
June 22, 2013
質問

How to replace a Smart object content with folder of JPGs

  • June 22, 2013
  • 返信数 2.
  • 4833 ビュー

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

このトピックへの返信は締め切られました。

返信数 2

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
Picturequest作成者
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!

JJMack
Community Expert
Community Expert
June 24, 2013

Really the distortion is not an issue. To mimic the 3D nature of the composite, I transform, Distort the corners to match. Then in the paperback I transform the SO with Warp to get the curved cover. Its then already distorted quite a bit. Most importantly, is that all the original pixels are there. Masking off width or height would be noticed.

For my purposes, all covers are 6x9" but then may vary 1/4-1/2" depending on the printer's specs.


In your case distortion does not matter that much for the aspect ratio difference is not great.  Your images are most likely portraits being distorted into a portrait cover.  If your image were landscaper you would notice much distortion.  If you create your 2-3 master templates for my scripts.  You could run 2-3 batch process to create all the populated files you need.  Then for the cover you would need to edit each one and just transform the image smart object layer and align the four corners to the cover.

In your case if you cameras have a 3:2 aspect ratio and you shoot portrait  orianted  images have a 2:3 aspect ratio  and your cover 6"x9" also has a 2:3 aspect ratio. So your camera's un-cropped portrait image fit perfectly onto you cover without distortion. So making your cover image a smart object and transforming that layer to your cover's perspective will work perfectly.  If your cameras have a 4:3  and you just resize them to a 3:2 aspect ratio there will be some distortion  but it will not be that noticeable particularly when its transformed to your cover's perspective.

Your case is simple a one image collage.  A one image collage does not require a complex solution.   My scripts were designed for more complex collages and can handle collage that have from 1 to 53 images. In a simple layered structure. I fact all that would be required is a Photoshop background layer and up the Photoshop maximum 53 Alpha channels named Image 1 through Image 53 to map image placement and stack order where Image I is place just above the background layer follow by Image 2 to Image N.  Alpha Channels can any shape.  All image are placed squarely in to cover the alpha channel mapping.  I would not know where to begin to try to determined  what perspective , slant, rotation etc images should have.  So I created an interactive script where users can select each image being populated and the tweak its placement  give it rotation and perspective,  I also created an automatic populating script the would populate all image for a template the remain open in Photoshop so the users can tweak the image that need tweaking.  I also create batch scripts that can create many populated collages for a template. These Populated collage files can be opened in Photoshop and the images can be tweaked.

Image can also have text stamped on them and Images and text layers can have optional layer styles applied. There are scripts that can replace a image in populated collage positioning and sizing the replacement image. An other script to change the text layers added font size and reposition them for the images populated. There a script that can tile as many images as you want into a new document.  Scripts to do picture packages etc.

JJMack
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.

Picturequest作成者
Known Participant
June 22, 2013

Hello again!

Thank you.

I will play with that script.

Max:-)