Graphic Design Stack Exchange is a question and answer site for Graphic Design professionals, students, and enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a photoshop file with over a hundred layers. Each of these layers have white backgrounds. I need to remove all of these #FFFFFF pixels automatically. I'm not worried about the actual content being deleted or anything. None of the content contains any pure white pixels.

share|improve this question

You'll have to remove the white layer by layer. There's no automated processes to strip white from all layers.

If it were me I'd probably use Select > Color Range to grab the white on each layer, then add a mask, repeat for each layer.

share|improve this answer

This is very easy to accomplish with a simple action and simple script.

For an action I started recording a new action called SelectWhite and did Select -> Color Range (selected white) pressed OK then I hit Delete to delete the white, and then I pressed CTRL + D to de-select the current selection.

I then stopped recording my action.

Now you could just use this action manually on every layer or you could use a script to do it for you...

Then here's the code you need for the script:

var doc = app.activeDocument;
for(var i = 0; i < doc.layers.length; i++){
    doc.activeLayer = doc.layers[i];
    doc.activeLayer.visible = false;

This script will iterate through every layer and run the action you made on it.

On my computer the app.doAction line of code looked like this:

app.doAction("SelectWhite", "Custom");

Note that the first part "SelectWhite" is the name of your action and "Custom" is the action set the action is part of.

You can just open up Notepad and past this code in there, then save it as a .jsx file.

Now go to:

File -> Scripts -> Browse... and select your script and run it.

That's it!

EDIT If you don't want to do the work yourself, I've extracted the action and script and placed them into a zip file. Just load the action into Photoshop and then run the script like I explained. You may need to adjust that one line of code in the script if there's some naming issues.

share|improve this answer
Oh man. Thank god. A javascript for loop!! Maybe I can understand this software after all. Seriously Johannes. Thank you! Is there a place I can read up on other script methods built into PS? (like doAction etc) – Peege151 May 21 '15 at 4:27
Absolutely. See here – Johannes May 25 '15 at 8:20

make an ACTION from Scott's answer and apply it to all 100 layers.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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