I have a layer that I want to merge and I want the dark colors in the layer to have more weight. How can I make it so that black pixels are 100% opacity, white pixels are 0%, and #7F7F7F pixels are 50%? I tried adjusting color curves, but that doesn't seem to be what I want.

  • Do you only want white, black and any gray to become transparent, or any color corresponding to its darkness? – Michael Schumacher Feb 24 '15 at 16:36
  • @MichaelSchumacher Any color, corresponding to its darkness. – aebabis Feb 24 '15 at 17:47
  • Ah, good. Thought my answer would be totally off when I reread you question and realized the achromatic examples. – Michael Schumacher Feb 24 '15 at 18:17
  • So, did one of the answers help to solve the task? – Michael Schumacher Feb 27 '15 at 10:02

In short:

I'd decompose the image two times, once into RGBA and once into HSV or HSL, with the Decompose filter: http://docs.gimp.org/en/plug-in-decompose-registered.html

Then, I'd do a RGBA compose with the RGB components taken from the first, and the V or L component (inverted prior to the compose, probably) of the second decompose for the A component: http://docs.gimp.org/en/plug-in-compose.html

  • The general idea is ok. Probably you need to simplify it just adding the same image as grayscale and use it as an alpha mask to the original colour one. – Rafael Feb 27 '15 at 17:05
  • This can work out to be the same, with a few minor differences (mostly about how you get there). My goal was to point out that there is something resembling darkness (or lightness) that can be used there - and in that regard, my answer should rather be expanded, because it just assumes that everyone knows what RGBA and HSV/HSL are - and something like the latter would also be part of a "grayscale copy to layer mask" approach, because there are different ways to convert an image or layer to greyscale. – Michael Schumacher Feb 27 '15 at 18:29

An easy way to add transparency in Gimp is to convert a color to alpha by choosing Layer > Transparency > Color to Alpha.

In your example choosing white as the color to convert to alpha (i.e. is fully transparent) will lead to the desired result making black 100% opaque, white 0 % opaque (i.e. transparent), and giving all shades of grey a corresponding semi-transparency:

enter image description here

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.