Jump to content

Transparent Color Swap


Recommended Posts

In the following picture, how do I make the brown color 100% transparent, the blue color 100% opaque and every gradient between the blue and the brown, semi transparent?

 

Seems like a color swap operation with color 1 mapping brown to 100% transparent and color 2 mapping blue to 100% opaque?

 

If I have to first select the brown for a background layer, how do you tell Paint.net to make the gradient's various levels of transparent?

 

The Magic Wand tool would seem likely too, but you have to do a kind of "transparent partial" erase.  A kind of "erase by color" perhaps?

 

Thanks!

 

image.png.ae5c9c3786354dd5ee29702dd47b2fb6.png

Link to comment
Share on other sites

I get best results for all these kinds of things with direct channel arithmetic. I use the channel ops plugin; it makes Saturation to Alpha obsolete.

 

1. Convert this to grayscale.

 

2. Invert colors so the symbol is darker than the background.

 

3. Increase contrast until the background is exactly pure white (255, 255, 255). Try to keep the foreground dark and strong. Brightness -29 and contrast 80 worked for me.

 

4. Now it's ready to act as a transparency map. Use channel ops to overwrite alpha with saturation (or use the gray to alpha plugin to do the same).

5. All you need to do now is make the black a different color. Use channel ops to individually set the red, green, and blue channels to what you want. The color of the symbol is RGB 77, 130, 184. You should have a very cleanly converted symbol.

 

comparison before and after

Left: before, Right: after (transparent background)

Link to comment
Share on other sites

The Color Clearer plugin followed by Red Ochre's Alpha Threshold may do what you want.

 

Use the Color Picker tool to set the Primary Color to the gray background color.

Run the Color Clearer. (Press the reset button on the color if it's not already set to the background color.)

Run Alpha Threshold. Adjust the top limit until the blue color is opaque.

 

Link to comment
Share on other sites

  • 1 year later...

Transparency is a property outside the color itself, and it's also known as alpha component, You can't code transparent as pure RGB (Red-Green-Blue), but you can use the RGBA notation, in which you define the color + alpha channel together:

 

rgba(red, green, blue, alpha)

 

Where alpha defines the opacity as a number between 0.0 (fully transparent) and 1.0 (fully opaque)

 

color: rgba(255, 0, 0, 0.5); /* 0.5 is the transparency value */

 

There's also the HEXA notation ( #RRGGBBAA ) now supported on all major browsers, which is pretty much the same as RGBA color code but using hexadecimal notation instead of decimal. It's called HEXA ( HEX + Alpha ). It takes in 8 digits instead of 6. The last pair is Alpha. So the pattern of pairs is #RRGGBBAA. Having 4 digits also works: #RGBA.

 

color: #FF000080; /* red at 50% opacity */

 

Here the FF0000 is the color and 80 is the transparency. Where 80 is the hexadecimal equivalent of 50%.

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...