2 Replies Latest reply on Mar 23, 2018 9:58 PM by aikembisd

    Trying to add layer from separate image automatically?

    aikembisd

      So, I've got 120 photos that were green screen keyed. The green screen has already been removed and they're now PNG files with transparent background. The idea was that I need to drop in a background image to these images, preferably not manually and one-by-one.

       

      I have used the batch/actions function many times to crop or resize images, but I can't seem to figure out how to use it to do this.

       

      Basically, I have an image, with a person in it, with no background, (transparent cutout) and I have ONE particular background image that I need to drop in behind them as a new layer. Save and repeat 120 times.

       

      When I tried to record a set of actions to do this, it seemed to list my actions accurately, but when I ran it as a batch, it just re-saved the main picture (of the person) without the background layer.

       

      Can someone give me some guidance on how to do this automatically?

        • 1. Re: Trying to add layer from separate image automatically?
          JJMack Most Valuable Participant

          A batch Action would be difficult to create unless all your png files have the same canvas size.  If they are the same size  an action could  Add canvas to make the png canvas the size of the background image you want to place in below the png layer. Place would add the background image above the png you would then move the smart object layer to the back and save your populated image file.

           

          If your png files vary in size you could tthink of it in other direction.   You have one background template you want to populate with a foreground image.   You need a script to batch populate a template that will resize the pngs and position them over the background.   However there is a parental problem, Populating  PNG image that have  transparent Boarders.  Transparent borders are trimmed off when you copy the layer to the Clipboard so there will be no transparent bordered when you paste in the clipboard image. Place also seems to trim transparent borders.  Placement and resizing can be a problem when you use png with transparent borders and you want to retain the png aspect ratio and size.   So you may want to protect you png that may have transparent borders. A simple bat action can add a 1% opacity pixel to the png canvas in the top left and bottom right corners.   To force the layer bounds to be the png canvas size to retain the png aspect ratio.   It would be easy batch populate a template with any of the batch populating scripts in my Photo Collage Toolkit.

           

          Photo Collage Toolkit

           

          Photoshop scripting is powerful and I believe this package demonstrates this here is a video showing a 5 image collage PSD template  being populated with images

           

          The package includes four simple rules to follow when making Photo Collage Template PSD files so they will be compatible with my Photoshop scripts.

          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.

           

          There are fifteen scripts in this package they provide the following functions:

          1. HelpPhotoCollageToolkit.jsx - Online Help
          2. TestCollageTemplate.jsx - Used to test a Photo Collage Template while you are making it with Photoshop.
          3. CollageTemplateBuilder.jsx - Can build Templates compatible with this toolkit's scripts.
          4. LayerToAlphaChan.jsx - Used to convert a Prototype Image Layer stack into a template document.
          5. InteractivePopulateCollage.jsx - Used to interactively populate Any Photo Collage template. Offers most user control inserting pictures and text.
          6. ReplaceCollageImage.jsx - use to replace a populated collage image Smart Object layer with an other image correctly resized and positioned.
          7. ChangeTextSize.jsx - This script can be used to change Image stamps text size when the size used by the populating did not work well.
          8. PopulateCollageTemplate.jsx - Used to Automatically populate a Photo Collage template and leave the populated copy open in Photoshop.
          9. BatchOneImageCollage.jsx - Used to Automatically Batch Populate Collage templates that only have one image inserted. The Collage or Image may be stamped with text.
          10. BatchMultiImageCollage.jsx - Used to Automatically Batch Populate Any Photo Collage template with images in a source image folder. Easier to use than the interactive script. Saved collages can be tweaked.
          11. PasteImageRoll.jsx - Paste Images into a document to be print on roll paper.
          12. BatchPicturePackage.jsx - Used to Automatically Batch Populate Any Photo Collage template with an image in a source image folder.  Images Rotates for best fit.
          13. BatchPicturePackageNoRotate.jsx - Used to Automatically Batch Populate Any Photo Collage template with an image in a source image folder.
          14. PopulatePicturePackage.jsx - Used to Automatically populate a Photo Collage template Fill with the same single image and leave the populated copy open in Photoshop.
          15. PCTpreferences.jsx - Edit This File to Customize Collage Populating scripts default setting and add your own Layer styles.

           

          Documentation and Examples

          1 person found this helpful
          • 2. Re: Trying to add layer from separate image automatically?
            aikembisd Level 1

            Thank you JJMack!

            I am lucky that all the media is exactly the same size and resolution

             

            I knew it had to be possible with the actions to do, but I did not know about the Place function! I was just trying to do it manually. Using the place action, I was able to build a set of actions that worked perfectly. Thanks for your input!