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!


3 Answers 3


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 publicdomainpictures.net


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.

  • Thanks for the tip! I'm aware of Actions as a method for automation - my question is more along the lines of what selection methods to use inside that action. Sorry if that wasn't clear.
    – CodeMoose
    Jan 29, 2015 at 14:16
  • Try color range for that. Then refine edge on the mask of the subject. These settings should be correct for the other image as well, if the shooting set-up didnt change too much.
    – user37657
    Jan 29, 2015 at 14:23

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. https://youtu.be/6ICVsi2pWyk

  • 3
    Welcome to Graphic Design SE. While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. Please edit your answer accordingly.
    – Wrzlprmft
    May 18, 2020 at 7:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.