RSS/Atom feed Twitter
Site is read-only, email is disabled

Color to alpha

This discussion is connected to the gimp-docs-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

4 of 4 messages available
Toggle history

Please log in to manage your subscriptions.

Color to alpha Julien Hardelin 28 May 17:02
  Color to alpha Ell via gimp-docs-list 30 May 22:55
   Color to alpha Ell via gimp-docs-list 30 May 23:04
    Color to alpha Julien Hardelin 31 May 05:22
Julien Hardelin
2019-05-28 17:02:31 UTC (almost 5 years ago)

Color to alpha

Hi,

I am trying to update Color to alpha, but I don't understand transparency and opacity thresholds.

Pop-up helps mention a limit that I suppose to be a transparency limit. "below" and "above" seem to me inverted.

I don't see how to describe these options.

Please give me explanations with, as much as possible, examples.

Julien

Ell via gimp-docs-list
2019-05-30 22:55:04 UTC (almost 5 years ago)

Color to alpha

On 5/28/19 1:02 PM, Julien Hardelin wrote:

Hi,

I am trying to update Color to alpha, but I don't understand transparency and opacity thresholds.

Pop-up helps mention a limit that I suppose to be a transparency limit. "below" and "above" seem to me inverted.

I don't see how to describe these options.

Please give me explanations with, as much as possible, examples.

Color to Alpha modifies the transparency (and color) of the pixels based on their distance from the selected background color (the "Color" option") -- the closer they are to the background color, the more transparent they become, with the background color becoming fully transparent. It's normally done in such a way that recomposing the result against the background color reproduces the original image.

The transparency and opacity thresholds control how close colors should be to the background color before they become fully transparent, and how far they should be from the background color before they remain fully opaque, respectively. With the default values of 0 and 1, only the background color becomes fully transparent, and only the colors farthest away from the background color remain fully opaque.

For example, while the default values work well for removing a white background from a black object, if the object is gray instead [1] it will become semi-transparent [2], since gray is midway between white and black. Lowering the opacity threshold to 0.5 fixes that, by keeping all pixels that are gray or darker (all pixels whose distance from white is 0.5 or more, on a [0,1] scale) fully opaque [3].

The transparency threshold works similarly: raising it causes more colors in the neighborhood of the background color to become fully transparent. This is mostly useful with noisy images, in which the background is not fully solid. However, unlike in other cases, when the transparency threshold is above 0, recomposing the result against the background color no longer reproduces the exact same image.

At the risk of being a bit technical, this can be visualized by thinking of the RGB cube. The background color is a point within the cube, and the transparency and opacity thresholds are two sub-cubes centered around the background color. Everything inside the transparency-threshold cube becomes fully transparent, everything outside the opacity-threshold cube remains fully opaque, and everything in between gradually transitions from transparent to opaque. In image [4] you can see the Red-Green face of the RGB cube. (1) is the background color (Red=0.5, Green=0.5, Blue=0.0), (2) is the transparency threshold (set to 0.1), and (3) is the opacity threshold (set to 0.4).

Hopefully this helps :)

[1] https://i.imgur.com/4dr2kvx.png [2] https://i.imgur.com/2lbMKIK.png
[3] https://i.imgur.com/fx5EeB3.png
[4] https://i.imgur.com/QocaTFH.png

-- Ell

Ell via gimp-docs-list
2019-05-30 23:04:11 UTC (almost 5 years ago)

Color to alpha

On 5/30/19 6:55 PM, Ell via gimp-docs-list wrote:

The transparency and opacity thresholds control how close colors should be to the background color before they become fully transparent, and how far they should be from the background color before they remain fully opaque, respectively. With the default values of 0 and 1, only the background color becomes fully transparent, and only the colors farthest away from the background color remain fully opaque.

I forgot to mention that the color pickers next to the transparency and opacity threshold options let you set their value by picking a color from the image, and calculating its distance from the background color automatically.

--
Ell

Julien Hardelin
2019-05-31 05:22:07 UTC (almost 5 years ago)

Color to alpha

Thank you Ell for your explanations. I will study them.

Julien