Replace a particular color with transparent

Chat about the original Pixelmator.
User avatar

2018-08-24 16:31:19

Big picture, is transparent a color? Hex? I mean, zero opacity.


Hey all. In my project I need to replace all instances of black with transparent.

I'm not making a background transparent. I know how to do that with layers.

I tried replace color but it doesn't allow transparent as a replacement choice. Or does it?


Thanks in advance.

Bill
User avatar

2018-08-24 18:49:34

Hi Bill.

You're right about replace colour. That won't affect transparency. There are a couple of methods you can use, though. Both may need some tidying up afterward depending on the complexity of your image.

Method 1 - If you can select it you can mask it.
1. Using your favourite selection tools, select everything but the black (or select the black and invert the selection).
2. Use Layer > Add Layer Mask to mask out the black (or right-click on the layer and Add Mask).
(alternatively if you're feeling cavalier, select the black and hit delete).
(Tip. You can move easily between selections and masks. To make a Mask from a selection, just Add Mask to a layer that doesn't have one. To make a selection from a mask, click on the mask and select Load Selection from the edit menu.)

Method 2 - Clipping masks for the win.
1. Create a copy of your layer.
2. With the copy selected and visible, use the Stylize > Threshold effect to make the bits you want white and the bits you don't want black.
3. Use the Other > Mask to Alpha to use the brightness of the image as opacity information.
4. Move this layer underneath the original.
5. Right click on the original and select Create Clipping Mask. This will apply the opacity information of the lower layer to the colour information of the upper.

I've assumed you're using Pixelmator 3.7.x for these tips, though they should work with earlier versions. If you're using Pixelmator Pro only Method 1 will apply (and menu items will be in different places).

Hope this helps. Let me know if you get stuck and post an image if you do. It'll be easier to show you either of those methods with your own image.

- Stef.
User avatar

2018-08-24 19:02:29

Hey st3f, thanks for reply.

Think of a Jackson Pollack with 10,000 pixels of black and the other 100,000 pixels are different colors. How would you select just the 10,000 black pixels if you want to turn them all transparent?

So, not sure how to even attempt method 1 or 2. I'm sure I'm just not getting something. I have too many black pixels that are too spread out to select them all individually.

It would be cool to just be able to manipulate the underlying HEX code. IF pixel = #000000 THEN change pixel to TRANSPARENT HEX.

Bill
User avatar

2018-08-24 19:24:35

Jackson Pollock? Method 2. Definitely method 2.
It's not as complex as it sounds. Trust me.
This might convince you. Jackson Pollock:
Image
Jackson Pollock with transparent black and a hideous vibrant green showing through from below.
Image
It may not be exactly what you wanted but here's hoping it's close enough.
(edit: If you want direct control of your pixels and can code in Java, JavaScript, or Python, you might want to have a look at processing.org. It's a simple self-contained IDE/language that can interact with images natively without loading any libraries. Might be overkill to learn just to edit one image, though. )
User avatar

2018-08-24 21:38:05

Hey st3f,

Got method 2 to work. I just DO NOT know or understand Pixelmator nomenclature. Also got the layers reversed
User avatar

2018-08-25 06:31:51

Yay. Glad to hear it worked.
Also got the layers reversed.
Me too. Every. Single. Time.