Is it possible to erase all colors in the 2nd layer of a PSD file in Photoshop except yellow in one step?

I have multiple images. Should I use the hex code to preserve the yellow color?


It's not possible in one step, but in a few perhaps. Make a selection of the yellow colour using Select > Colour Range, and use the colour picker to select the yellow item, and adjust the fuzziness and range sliders until you get a good selection, then add a layer mask to the layer.


Example image of using a layer mask

  • Thank you. But as the yellow color is in random places I think I can't run it in batch process and that's where I need help. – blackmole Aug 1 '17 at 22:02
  • You could select the "Yellows" preset from the dropdown in the colour range dialog. – Billy Kerr Aug 2 '17 at 7:10

I'm going to create an action to remove all colors except yellow. Then I'll create a script that get each *.psd files in D:/myFolder and will apply the action to second layer of each loaded file. Then I will save each file in the same path. so....

First create an Action

  1. Press Alt + F9 to open Action window
  2. Click on "Create a set" button and rename it to mySet enter image description here
  3. Click on "Create an Action" button and rename it to myAction enter image description here
  4. Go to Select -> Color Range (selected Yellow) pressed OK
  5. Press Ctrl + Shift + i (to inverse selection)
  6. Hit Delete button on keyboard to delete the Selected colors
  7. press CTRL + D to deselect the current selection

Second create a Script

Create a folder in drive D and rename it to myFolder ("D:/myFolder") and copy & paste all psd files there. (Keep source files in another directory)

  1. Open notepad and copy and paste the following code
  2. Save the file with ".jsx" extention
  3. Go to Photoshop -> File -> Scripts -> Browse... and select your script and run it

var inFolder = new Folder("D:/myFolder")
if(inFolder != null)
var fileList = inFolder.getFiles(/\.(tif|psd|)$/i);
for(var i = 0 ;i < fileList.length; i++)
var docRef = open(fileList[i]);
var doc = app.activeDocument;
doc.activeLayer = doc.layers[1];
app.doAction("myAction", "mySet");

That's it

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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