I have the following image of a yellow marker.
Everything around the marker is fully transparent.
But the yellow and the white part inside the marker is half-transparent.
I do not want any transparency inside the marker, but i want the outside-transparency to stay.
How do i do this in GIMP?
5 Answers
These are the steps I took:
Remove alpha channel (Layers > Transparency > Remove Alpha Channel). This will replace the transparency with the selected background color (usually white)
Add transparency channel again (Layer > Transparency > Color to Alpha choose white).
Delete selected background (Del)
Another way (by the way, since your white is fully opaque, I won't address it):
- Sample the yellow with the color picker
- Use the
Select by Color
tool to select the yellow (this should select both the circle and the "triangle") Select>Grow
by two pixels (the selection should bleed over the white and the black)- Set the bucket-fill tool to
Behind
mode (selector on top of the Tool options dialog), and toFill whole selection
- Bucket-fill the selection
The behind
mode only fills the "transparent" part of pixels (fully opaque pixels are therefore unchanged). In other words, it is equivalent to adding a layer under your current layer and filling it with the color.
- Use the fuzzy select tool to select the background.
Select>Grow
by two pixels, so that the selection includes the edge pixels.Select>Invert
Layer>Mask>Add layer mask
and initialize to "Transfer layer's alpha channel"- Bucket-fill with white (this paint should go to the layer mask)
Layer>Mask>Apply layer mask
when you are happy with the result
GIMP and other raster image editors aren't the ideal software for such graphics. Better to look at vector image editing software such as Inkscape(dot)org which is free and Open Source. Recreating such simple graphics in vectors is easy, plus it will be better quality, and rescalable.
Anyway, you asked about GIMP, so here's one way to do it.
- Open the PNG in GIMP
- Right click the layer in the layers panel, and duplicate the layer about 4 times (see screenshot below), until you can't see through the yellow
- Layer > Merge > Visible
- File > Overwrite
If you want to keep the original, make sure you work on a copy!
By way of comparison, here's an example recreated in Inkscape, and exported as plain SVG. You can download the SVG and drag it into your browser to view it.