Take the 2-minute tour ×
Graphic Design Stack Exchange is a question and answer site for Graphic Design professionals, students, and enthusiasts. It's 100% free, no registration required.

I want to replace the whiteness in pixels with transparency in the same way as described in this question - i.e. for lighter pixels to be made proportionally as transparent. All solutions found via google are based on magic wand or other methods that do not work for my needs. I'm sure there used to be a way to do this in earlier version of photoshop (a simple functions to replace a colour with transparency), but I can't it in CS6. 'Replace Colour' has no alpha options. Grateful for any pointers.

share|improve this question
2  
Why is the question you linked to insufficient? Have you tried Select > Color Range... to create a selection then mask or remove it? –  Scott Oct 3 '13 at 14:55
    
Because I suspect the Imagemagick solution in that link won't work in CS6 ;) The select method is surely also flawed because it constrains the selection. I want the lightness value in all pixels to convert to alpha value. –  geotheory Oct 3 '13 at 15:01
    
Not a full answer, but... maybe it's worth trying to make a b&w copy of the image and pasting that into a layer mask? –  Vincent Oct 3 '13 at 15:06
    
Note that imagemagick is free and open source. You can use the tool to make intermediary images which you can then further manipulate in PS6 or any other image editing software. There is no reason to limit yourself to any proprietary tool. The linked answer however does not sound like the right tool for you in this specific instance because it relies on having the blue gradient background used in the development of the original item as a unique image for the masking process. –  horatio Oct 3 '13 at 16:41

2 Answers 2

up vote 30 down vote accepted

One method is to use the original image/layer as its own layer mask. You'd create a duplicate of the layer, desaturate and invert it, pasting the greyscale result into the original layers layermask.


Update: Here are some step by step instructions:

Start with your flattened image:

enter image description here

Add a Saturation/Hue adjustment layer and turn down the Saturation until the image has no color. If you don't have any gradient in your original image, you can just use a Threshold adjustment layer instead, which will result in 100% black or 100% white results.

(Technically you could skip step, as we'll be pasting it into a layer mask which will convert it to greyscale anyway. This will give you a good visual reference though to tweak the black/white balance)

enter image description here

Add an Invert adjustment layer, then a Curves adjustment layer. Tweak the Curves until everything you'd like to be solid/opaque is white, and everything you want fully transparent is black. You may have to tweak this a few times to get the amounts right.

enter image description here

Now CTRL + A to select the entire image and CTRL + SHIFT + C to copy the combined greyscale result. Create a layer mask on your original layer. Now ALT + click in the layer mask icon to enter direct edit mode. Now paste the black and white image you just copied into there.

enter image description here

Now click back on your original layer to exit the layer mask direct edit and hide all your adjustment layers.

There you have it! If you find your finished result isn't fully opaque (solid) in the areas you like it, you can either tweak the curves and do it again (you'll need more white in those areas), or just duplicate the result/layer a few times until it becomes less transparent (example below).

enter image description here

This also works on black backgrounds, just don't use the Invert layer filter.

share|improve this answer
    
Thanks John (and @Vegard) this is it –  geotheory Oct 4 '13 at 15:40
    
what if the background I'd want to be transparent is blue/grey? –  Pineapple Under the Sea Nov 1 at 2:15
    
@Pineapple Under the Sea - It can work on colored backgrounds, but you would need enough tonal contrast. For that reason it usually doesn't work well on mid-tone colored backgrounds. Try a hue/saturation filter on the original image and remove the color, if the background looks similar to the part you want to keep (similar tone in greyscale), this method probably won't work well for you. In that case you'll have to paint or trace it out. This method works by exaggerating the tonal difference of the background vs part you want to keep until it is black vs white... –  John Nov 1 at 12:55
    
...If you can't accomplish that using levels, curves or the threshold filter, then this method will not work. –  John Nov 1 at 12:56

You can use blending to add transparency:

  1. Ensure that the Background layer has been unlocked, and set to 0% opacity (transparent).
  2. Right click the layer you want to add transparency to, pick the "Blending Options..."
  3. Locate the scale under the "This layer:" that is under the "Blend if" box
  4. Press and hold the alt key while dragging on the white knob, the further you drag it to the left the more transparency is added based on the whiteness of the layer. See the image of how the two white knobs are separated.

"Blend if" box

If you also want the layers below it to have the same transparency as the current layer you can set the "Knockout" under "Advanced Blending" to "Deep".

I have only tested this in CS5.5, but I think it should be very similar in CS6.

share|improve this answer
    
I love you, Vegard. –  pilau Sep 5 at 12:58

Your Answer

 
discard

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.