5

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? enter image description here

0

5 Answers 5

1

These are the steps I took:

  1. Select background with the select by color tool (enter image description here)

    enter image description here

  2. Remove alpha channel (Layers > Transparency > Remove Alpha Channel). This will replace the transparency with the selected background color (usually white)

    enter image description here

  3. Add transparency channel again (Layer > Transparency > Color to Alpha choose white).

  4. Delete selected background (Del)

    enter image description here

1

Another way (by the way, since your white is fully opaque, I won't address it):

  1. Sample the yellow with the color picker
  2. Use the Select by Color tool to select the yellow (this should select both the circle and the "triangle")
  3. Select>Grow by two pixels (the selection should bleed over the white and the black)
  4. Set the bucket-fill tool to Behind mode (selector on top of the Tool options dialog), and to Fill whole selection
  5. 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.

0
  • 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
0

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.

  1. Open the PNG in GIMP
  2. 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
  3. Layer > Merge > Visible
  4. File > Overwrite

If you want to keep the original, make sure you work on a copy!

enter image description here

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.

0

There is now Layer/Transparency/Threshold Alpha for anyone who finds this thread.

Your Answer

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

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