Thread Rating:
  • 1 Vote(s) - 1 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to delete color of cutout areas?
#3
(08-28-2018, 05:14 PM)Addez123 Wrote: When I cut out the green from an image, it will make the area completely transparent BUT keep the color information.
This never happend in old gimp versions (which also had BW filter, like any other normal image editor)


This can be rejected when exporting the image, but while editing I will always have these ugly disturbing green fussy borders, making me this I didn't cut it correctly.
How do I make it so that fully transparent pixels are completely black?

If you have remaining borders, you are not cutting out properly. My money that you do a Fuzzy select/Color select and [Delete].

The problem with that technique is that it overlooks  a fundamental property of the Fuzzy select/Color select: they either completely select the pixels, or don't select them at all. Now, zoom on the borders: you will see pixels that have a tint which is a blend between the subject color and the background color. These are the pixels that makes the object's edges look smooth. Without them, the edges would look pixellated.

So, when you use the selector, depending on the threshold some of these are selected (and will be deleted) and some are not (and will participate in the faint rim you complain about). And there is no good value for the threshold: too big and you select too much and you get pixellated edges, too small and you have the rim. And in between, you have both.

Doomed? Not really. What you really want is not to erase these pixels, but to erase their green part, in other words, to convert that green part to transparency, so that the pixels that are completely green become completely transparent, those that are not green at all remain opaque, those that are a bit green becomes a bit transparent and those that are quite green become quite transparent.

Is there a tool for this? Of course, otherwise I wouldn't be writing this. There are actually three (in 2.10, only two in 2.8) that all do the same thing but in slightly different ways. The best known one is aptly named "Color to alpha" (Colors>Color to alpha). By design, it removes the target color and replaces it by transparency, so that if you put the resulting image over a background filled with the removed color, you reconstruct the initial image.

Now, there is a catch: there are many ways to obtain that result. For instance a pixel initially light gray over a white background can be converted to either a nearly transparent black pixel, a not very transparent dark gray pixel or even a fully opaque light gray pixel. In practice,Gimp will always aim for the maximum transparency.

And then there is a trap: you subject can have areas that are close to the background color, so without some care these will become slightly transparent as well. But this can be avoided with a selection:
  • Fuzzy-select the background
  • Select>Grow the selection by 2px so that it covers the edge pixels
  • Apply the Color-to-alpha, which will act only on the background and the edge pixels and will leave more of the subject untouched
This technique (slightly enhanced to cover dirty backgrounds) is available as the ofn-erase-background script.

Now, the other tools:
  • You can bucket-fill in "Color-erase" mode. This is the same as using Color-to-alpha for to remove the fill color
  • In 2.10, you can put a layer above in "Color-Erase" mode, the color you paint is removed from the layers below. This allows to remove complex backgrounds (typically, gradients)
Reply


Messages In This Thread
RE: How to delete color of cutout areas? - by Ofnuts - 08-28-2018, 09:15 PM

Forum Jump: