Is there a way to batch remove the same background from multiple images?

Someone asked me a Photoshop question the other day, and after some time thinking on it I couldn’t come up with an answer – hoping someone here can shed some light!

Let’s say I’ve got a batch of photos of people all standing in front of the same textured background – for example, headshots against a studio background. If I wanted to remove the background from all these photos, there are a few ways to go about it; the problem is all methods I know are manual, and large batches become pretty tedious.

Now, let’s say the background in each photo was stationary (maybe a few px of wobble), and I had a photo of the complete background without any figure blocking it. Would there be a way to use the complete background as some sort of inverse/subtractive mask, so all you’re left with is the person? At the heart of it, this is about automating the process of removing the same background from every image – so any alternate methods are welcome too. Thanks in advance!


Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

What you are looking for is known as a difference mask, difference key, or difference matte. To get clean results, you’ll need a very stationary background.

I’m not the best at creating actions, but here is the sequence I was able to come up with. This assumes you start out with the foreground layer as “Layer 2” and the background layer as “Layer 1”.

Difference mask action Layer panel screenshot

Here’s the action in … action:

Difference mask script

And here’s a link to download it (test images 1, 2). Anyone more proficient than I with actions can feel free to suggest ways to improve that

Laptop and garden photos courtesy of

Method 2

Best way to do this is by creating an action.

Do it once in a procedural way (so no pentooling) with selection methods and then play the action for the other images.

Method 3

You can do this very in a easy way using adobe photoshop 2020. Here is a script for this and how to use it video.

All methods was sourced from or, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Notify of

Inline Feedbacks
View all comments
Would love your thoughts, please comment.x