Skip to main content
Participant
February 14, 2025
Question

Photoshop Replace Background with Actions and Batch Processing

  • February 14, 2025
  • 2 replies
  • 322 views

Hello everyone,

I have a PSD template that contains:

  • A background image (which I need to replace).
  • Two folders with elements that must stay the same.
  • 50 background images stored in a separate folder on my computer (not inside the PSD).

I want to automate the process so that Photoshop:

  1. Replaces the background with each image from my folder.
  2. Keeps the other layers unchanged.
  3. Saves each result as a JPG in a new folder.

I tried different methods, but nothing works properly. I’ve watched YouTube videos, searched forums, and even asked ChatGPT—but I’m exhausted and still don’t have a clear solution. 😩

How can I automate this correctly? Any help would be greatly appreciated!

2 replies

Stephen Marsh
Community Expert
Community Expert
February 15, 2025

Another possible option:

 

https://github.com/mechanicious/photoshopCompositionComposer

 

Use the "Load Files into Stack" script that ships with Photoshop to get the 50 layers into a file. Select all the layers and put them into a group. Add the layers from the other template into another group as per the instructions at the link above, however, they would need to be merged to a single layer which could be problematic if the layers have opacity or blend mode interaction with the background.

 

Other scripts that can combine static layers with variable layers to create multiple composites include:

 

https://github.com/Paul-Riggott/PS-Scripts/blob/master/Layer%20Saver.jsx

 

https://github.com/Paul-Riggott/PS-Scripts/blob/master/Layer%20Saver%20Plus.jsx

 

Stephen Marsh
Community Expert
Community Expert
February 14, 2025

@Daniil31045941kvnz 

 

With batch actions, your options are limited to having the batch command open each of the 50 variable background images, then the action can add the layers from the template document over the variable backgrounds.

 

Another option is to use Photoshop Variables, AKA "data-driven graphics". Using the pixel replacement option to swap out the background for each of the 50 background images listed in a spreadsheet column:

 

https://helpx.adobe.com/au/photoshop/using/creating-data-driven-graphics.html

 

Yet another option is to use scripts, whether a custom script specifically designed for your project or a generic script:

 

https://github.com/MarshySwamp/JJMack-Archive

Participant
February 14, 2025
quoteWith batch actions, your options are limited to having the batch command open each of the 50 variable background images, then the action can add the layers from the template document over the variable backgrounds.

 

Could you help with first? Cuz I try, and cant get it...

Stephen Marsh
Community Expert
Community Expert
February 14, 2025
quote
quoteWith batch actions, your options are limited to having the batch command open each of the 50 variable background images, then the action can add the layers from the template document over the variable backgrounds.

 

Could you help with first? Cuz I try, and cant get it...


By @Daniil31045941kvnz


I can do that, however, I am having to make assumptions, which may not be accurate if your files are different. It would be better to give advice based on your specific files.

 

Are all of the 50 background images the same pixel dimensions and resolution?

 

Is the template background the entire canvas width and height, matching the 50 different backgrounds?