1

The question has already been asked, but the accepted answer is really not what I'm looking for.

I want something that measures the alpha value of every pixel, and turns that into a given colour. So, for example, if I have a yellow pixel with 50 % transparency, and I "alpha-to-colour" it to red, then it becomes orange and fully opaque. A plain yellow pixel with no transparency would not be touched.

In other words, it's really like a perfect "undo" of colour to alpha.

Up to now, I have no clue how most layer modes work, but if there is a way of using a layer which has been filled with a plain colour to do what I'm looking for, that could be an option. I have no clue how I should ask this to a search engine in less that thirty words, so I decided I'd ask humans for a change.

4
  • I don't understand why the answer you link to isn't what you're looking for. it seems like the perfect fit. A very simple thing really. You have a layer with transparency and want to add color to all pixels according to their alpha. So you add a layer below with the color you want.
    – Wolff
    Commented Jun 9, 2022 at 21:36
  • 1
    Why does adding a layer underneath not work for you? It would do exactly what you say you want. A 50% yellow with a solid red layer underneath will look orange, and solid pixels will remain unaffected. The finished image will be fully opaque. You can even merge the layers if you want. You don't need to use any special layer blending modes for this. "Normal" mode will work just fine,
    – Billy Kerr
    Commented Jun 9, 2022 at 21:46
  • 1
    @BillyKerr I was having the problem shown by the first image in xenoid's answer, so I managed to solve that using the provided explanation. Thank you.
    – GPWR
    Commented Jun 10, 2022 at 13:30
  • @GPWR - excellent, glad we could help!!
    – Billy Kerr
    Commented Jun 10, 2022 at 13:33

1 Answer 1

2

In Gimp 2.8 the "perfect undo" of Color to alpha is either:

  • Add a new layer below, and bucket-fill with the color you extracted
  • Bucket fill the layer in "Behind" mode, using the color you extracted.

However, in Gimp 2.10 the answer is more complicated. The result of Color-to-alpha is "undone" only by using the "legacy" blend modes.

Using standard blend modes you get this: Clock-wise from top left: original, color-to-alpha, "layer under", and "bucket behind". The bottom two are not the same as the original:

C2A with standard modes

While using the legacy modes(*) (layer blend mode for the "layer under" case, and paint mode for the bucket-fill) you get the expected results:

C2A with legacy modes

Gimp 2.10 also added a "Color erase" mode when painting that produces the same results as the Gimp 2.8 Color-to-alpha, but that can be undone using the standard blend/paint modes:

Color erase with standard modes

(*) Legacy modes are picked using the small selector at the end of the main mode selector (yellow circle arrow for default, Wilber's head for legacy).

2
  • Is this not to do with the default Normal blending mode? Doesn't changing to Legacy: Normal II work?
    – Billy Kerr
    Commented Jun 10, 2022 at 9:28
  • 1
    @BillyKerr You are indeed correct. Amended the answer.
    – xenoid
    Commented Jun 10, 2022 at 9:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.