An InDesign script for batch processing multiple Text, GREP, Glyph and Object queries
Replicating GIMP "Color to Alpha" in Photoshop with the Background Eraser tool
This technique only mimics Color To Alpha when dealing with black or white backgrounds. As each tool serves a different purpose (in different programs), its really only at the extremes of black and white that we coincidentally get the same results. We'll dive into some examples soon, but first let's examine the settings we need.
Keep in mind that the Background Eraser is a destructive tool, make a copy of your layer beforehand! Also, switch your document to 16 bits per channel to reduce potential banding and posterisation.
Background Eraser tool settings
- Brush size: reasonably large to reduce the number of passes it takes; in this example which is 1920x1080px I've used a 800px brush
- Hardness: 0%, prevents line artifacts; try it on 100% to see what I mean
- Spacing: 15%, space out the brush to avoid unnecessary lag
- Sampling: Background Swatch, prevents other colours from being sampled
- Limits: Discontiguous, don't stop removing colour when we hit an edge
- Tolerance: 100%, remove it all!
- Protect Foreground Color: unchecked, not needed for this example
For comparison: GIMP Color To Alpha
Let's remove the entire black component from this image.
Replicating in Photoshop
Now let's achieve the same result in Photoshop. Using the aforementioned settings, erase the background with the Background Eraser tool. Remember that the tool uses the Background Color swatch.
Now it looks as though Photoshop has removed a lot more colour information overall compared to GIMP, however the two programs just render transparency differently. Exporting from GIMP and bringing it into Photoshop will show that there is perceptibly no difference.
Removing colours other than black or white
Earlier I did mention this only 'works' on removing black or white. Let me show you what happens if we try to remove yellow (#FFFF00) in Photoshop.
Let's try removing yellow (#FFFF00) in GIMP.
Color To Alpha reached into the red and green a little more, as one might expect when removing a colour cast. It even removes some yellow components throughout the blue and magenta (noticeable in the glow).
This highlights the main difference between Background Eraser and Color To Alpha; Photoshop focuses on removing a colour whereas GIMP turns colour information into an alpha mask, where weak colour becomes weak alpha.