How to automate batch merge 2 images?

New Here ,
Feb 13, 2019

Copy link to clipboard

Copied

Hi there,

For my online shop, I have lots of product image to create based on a simple PSD template background.

Here the steps I would like to automate:

  1. Open my background image (PSD or other formats)
  2. Open product image onto another layer
  3. increase product image to about 40-50%
  4. Position product image on the perfect center of the background image
  5. Save the image as a new file
  6. Go back to step one for the next image

Is this possible with actions and batching? I would like to mention that I'm not an expert in Photoshop and it's scripting.

Here is the example of the final work that I've previously manually done.

https://99japan.com/collections/trading-card-game

Best regards,
Geoffrey

Topics

Actions and scripting

Views

2.5K

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Adobe Community Professional ,
Feb 13, 2019

Copy link to clipboard

Copied

Yes that's possible with Actions only I think, but I would recommend scripting

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Most Valuable Participant ,
Feb 13, 2019

Copy link to clipboard

Copied

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  eighteen 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 - Preferences Use in several of the above scripts. Edit this file to change default settings and add layer styles.
  16. BatchReplaceOneObject.jsx - Used to populate simple Mockup templates. Simple Mockup have one rule the top layer must be a Smart Object Layer it contents will be replaced and a Jpeg file saved.
  17. BatchUpdateSmartObject.jsx - Used to populate simple Mockup templates like BatchReplaceOneObject script but can update more than a single smart object layer.
  18. BatchMockupTemplates.jsx - Used to populate mutiple Mockup Template that need to be populated eith the same replacement image objects.

Mockup Support Added

I created my Photoshop Photo Collage Toolkit nine years ago and Avoided supporting Templates that used Smart Object layers to warp, to add perspective,  to rotate, add any distortion to images. Because replacement Image file needed to have exactly the same Aspect Ratio, Size  and Print resolution as the Object in the Template's smart object layers object. Lately there have been some threads in Adobe Photoshop scripting forums dealing with updating/populating  products Mockups Templates that have prototype smart object layers that need to be updated to create the output mockup files.  These were good threads and prompted me to do some thinking.

So like my Photo Collage Template design has four simple rules.   I came up with four simple rules for Mockup templates.  I find that I can easily modify Photo Collage Templates and Mockup Template files I download from the web so they comply with my Photo Collage Template rules or my Simple Mockup Template rules.   Mockup templates may be far from simple the only simple part is they are easy to update.  So I have add support to my Photo Collage Toolkit to support Mockup templates.

Simple Mockup Templates Four Rules

  1. Simple Mockup Templates Only the Smart Object Layer on the top of the Template layers stack will be updated then a Jpeg file saved.
  2. Only Photoshop Objects are support in the top smart objects layers. That is they can not be Object File that are not supported by Photoshop like Camera RAW Files or Illustrator file like .ai, .svg.
    I suggest these objects should be PSD or PSB that Photoshop creates. Avoid using PNG objects in Mockup template. For when replace content is used to replace .png  objects within a .psd template which has your png's object the replace content operation is very slow.
  3. The first None Smart Object Layer near the top of the layer stack Marks the end of Smart Object Layers the will be updated. Lower Smart Object Layers only update if they share top layers objects.
  4. The Replacement Image Collection need to be in sub folders named obj0, obj1, obj2, .... objN. Each folder must contains the same number of replacement Image files.

For Details and Download use this link Documentation and Examples

JJMack

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Adobe Community Professional ,
Feb 14, 2019

Copy link to clipboard

Copied

Yes, this is relatively easy with actions and batch/image processor script/image processor pro script. There have been many topic threads where this has been covered in great detail. Here are four such examples that I can easily recall:

Re: How to bulk add background to various photos?

Simple action to replace image from walls

Batch Processing Question

Photoshop Action that can autosave 50 design

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Adobe Community Professional ,
Feb 15, 2019

Copy link to clipboard

Copied

Here is a visual of the process described by myself in the previous links using your assets (click to enlarge):

Batch-Combine-Hero-Image-Background.jpg

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Most Valuable Participant ,
Feb 15, 2019

Copy link to clipboard

Copied

First the OP wants at least two image in the composition.

Scripting is so much powerful than Action and batching an action.   There are scripts you can download to do things like the OP want to do.  All they need to do is create a Photo Collage  or a Mockup template and point a script at the template a source image folder they have the images the want to populate into the template,  and point to the output folder. The click a run.  Scripts can populate 1 or more images  into a template.  My Photo Collage Template design has a limit of 53 images because Alpha Channels are used in the templates to map image location size and shape.  Mockup template use smart object layer on the top of the layer stack the can have the script eithe replace the smart Object layer object or edit their content.  Again just point the scripts to the templates source image and output folder.  His example show they would need to create Mockup template for they want at lease one image rotated some.  

It would be very difficult or impossible to support image rotation and multiple image in an action.  Action are very easy to record but have many limitations and can not use logic without using some Photoshop Scripting.  Action would need to be recorder for each layout  they can not use logic to find our how many image need to be populated the action has to be recorder to populate two image and would most liken need to be interactive for the user to select images if  more then one  image need to  be populated batch only open one image  for a batched action. In you diagram above it look like Source square image folder is not references  so I guess a second batch process would be needed for that  and the first batch would need to save  PSD and the second batch would need to be scripted to match the square  images with the psd populated by the batched action.  Most Action I have seen that populate template are used manually not batched. 

Scripts can do much more than actions but you need to have programming skills to create you own custom  scripts.  However, there are many Script available for use. Photnerge, Lens Correction, Load files into a stack, Export layer to files, Image Processor, Image processor pro. Search the  web there are many Photoshop scripts available for you to use.

JJMack

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Adobe Community Professional ,
Feb 16, 2019

Copy link to clipboard

Copied

Scripting is so much powerful than Action and batching an action.

Agreed, yet again, this is like groundhog day… JJMack, we must have had the same discussion at least a dozen times over the years. A question is asked on how to do something via an action using batch/IP/IPP and I show how it is done, often mentioning that actions can only do so much and that scripting may be required for some projects and that it will depend.

First the OP wants at least two image in the composition.

That was not clear to me from post #1, I was of course presuming that the “square” images already contained the large square image and the smaller rectangular image in the same photo. I also presumed that all images were already on a transparent background. One has to presume a lot sometimes and work with the info at hand or have better info provided which will then require a different workflow.

So again, I agree, scripting is powerful and can use logic and do many wonderful things beyond what is possible with actions.

Sometimes one needs the power and flexibility of a script. Sometimes finding such a script takes longer than a project deadline. Sometimes working out how to make existing assets work with a ready made script is challenging for a user, or perhaps working out how to use the script is the problem. Sometimes a user can’t write or hack a script, nor can they wait on the generosity of somebody that can script. Sometimes a user just has to get the job done and it is more pragmatic using a multi-step action + batch/IP/IPP workflow, where the job is finished long before an alternative technically better scripted solution can achieve the same end.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Most Valuable Participant ,
Feb 16, 2019

Copy link to clipboard

Copied

I sorry if I offended you.  You are good with Photoshop your an ACP  but it is very hard for me to believe that

was not clear to you.  So I think your append are a bit off base and miss leading.

JJMack

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
New Here ,
Jun 27, 2020

Copy link to clipboard

Copied

 

Hi! So I recently tried this, but i´m still having some issues with creating the actions. I´m still new to PSD is there a script temp that you have and can share with me?

I´m really tring my best but can handle to make this happen, or otherwise if there is a tutorial I can see to learn how to do it? Thank you very much for the help!

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Adobe Community Professional ,
Jun 27, 2020

Copy link to clipboard

Copied

There isn't any useful info in your post to offer help or advice.

 

I'd recommend creating a brand new topic thread specifically for your situation so that it isn't buried in this topic. Include a link back to this topic if you like.

 

Provide cropped screenshots and or links to assets, such as a couple of sets of the source files and finished examples of what you are trying to achieve through automation.

 

Also a clear and concise explanation of the process to go along with the images.

 

That will be a better start to the discussion.

 

The forum is here to help.,,

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Most Valuable Participant ,
Feb 16, 2019

Copy link to clipboard

Copied

It is not hard to make template or modify existing templates so they will work with my scripts. Here is a zip file for your card setup Temp Folder Zip

All you need to do is organize your assets the correct size and resolution for you will be replacing smart objects.  If you do not have all your assets the correct size and resolution, if they have the correct  aspect ratio you can have the script edit your assets into the smart object scaled to the object size.  Just create templates then point the scripts to your templates, your Images Folders and output folder and click create.

Capture.jpg

If you use the wrong size image and use the script edit option the is what will be the result. Here I used 4K 3840x2160 replacement images to replace all smart object layer images

Capture.jpg

JJMack

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...