[Techtalk] GIMP: Changing all set pixels to black

Miriam English mim at miriam-english.org
Thu Jan 7 23:56:07 UTC 2016


Hi David,

Gimp is such a flexible tool there are generally many different ways to 
accomplish a task. What is the nature of the area outside the outline? 
And what is the nature of the area inside the outline? Is the outline 
very thick? Are there many fine details in the outline? Is the outline 
all connected or are there many disconnected parts?

If the outline is reasonably thick, and the area inside and outside the 
outline image is not uniform, you can use the "fuzzy select" tool (it 
looks like a magic wand) to select contiguous regions. A bit of trial 
and error will be needed. Make sure the tool options panel is displayed 
(one of the tabs below the main toolbox). Note the position of the 
threshold slider. Now click on the outline. Much of the outline should 
be selected, indicated by "crawling ants". You can increase how much is 
selected by altering the threshold slider. Do it over and over again 
until you are fairly happy with the selection.

If there are some disconnected parts of the outline then you can select 
more than one part by holding the Shift key down when you click the 
mouse. Or if there are lots of parts (for example the outline of letters 
in a logo) then you can use the "select by color" tool. It works in a 
similar manner.

If, no matter what you do, some parts of the outline remain unselected 
or else inclusing them in the selection also gets other parts of the 
picture then get as close as you can to what you want and then choose 
from the "Select" menu, the "Grow" or "Shrink" menu items.

When you have all selected that you want, then choose the "fill" tool 
(it looks like a bucket pouring ink). Make sure the tool options panel, 
which is now the bucket fill options, has "Fill whole selection" chosen. 
Now make sure your current color is black (or whatever color you want to 
use) and click on the selection and it will all turn black.

If either inside or the outside of the border is a single color then 
another easy solution is to use the "fuzzy select" or "select by color" 
to make either all the inside or the outside a single selection, then 
careful use of the "Select" menu's "Grow" or "Shrink" menu items can put 
the selection pretty-much exactly where you want it. Then if you 
selected inside the shape just choose the "fill" tool (make sure "fill 
whole selection is set"). If you selected outside the shape then from 
the "Select" menu chose the "Invert" item and do the same.

Another nice thing you can use is, before you fill, you can choose from 
the "Select" menu, "Feather". Then when you fill it will give a soft 
edge. But don't do this if you want a sharp edge.

Yet another thing I often do is add a transparent layer, then after I've 
made a suitable selection from the image layer I switch to the 
transparent layer and fill the selection there. That lets me delete the 
original image layer and I'm left with a silhouette surrounded by 
transparency.

If you want to simply change shades of gray to black, another very 
useful trick can be go to the "Colors" menu and choose the "Curves" 
item. This displays an interactive information window that along the 
horizontal axis represents the current shade of all the pixels in the 
image. A histogram uses the vertical axis displays how many pixels in 
the image are that color. Also, a diagonal line reuses the vertical axis 
to let you control how light or dark any colors are. It is difficult to 
explain, but easy to understand. Play with dragging the diagonal line 
around for a while and after a short time you will gain an intuitive 
understanding of its use. You can add control points to the line to drag 
it into any shape, or remove control points by dragging them off the 
window. It looks complex, and at first it will seem so, but it is a 
truly wonderfully simple and powerful tool. At some point you will 
suddenly grok it. It is one of my favorite tools. If you take a photo of 
someone and they are in shade on a sunny day so that you only see their 
feet, you can use this tool to reveal what was hidden in shadow. It has 
many other uses too.

If you strike further problems or something I've written is unclear or 
doesn't seem to do what you want let me know.

Cheers,

	- Miriam

On 08/01/16 08:48, David Sumbler wrote:
> In one of my GIMP projects I have layers which contain outline shapes.
> These are from .bmp files, and unfortunately there has been some
> antialaising (or dithering - I'm not sure what these terms mean
> precisely), so the pixels in the outline are not all black, but various
> shades of grey.
>
> I want the outline to be entirely black so that I can then fill the area
> with black and then convert the solid shape to some other colour.  The
> area outside the shape will be transparent.
>
> I have tried various things that I found on the internet for changing
> all colours to black, but they do not seem to affect the grey pixels in
> the outlines.
>
> If I use the colour picker on one of these grey pixels, it actually
> produces black, so I think that they are not really grey at all, but
> black with some degree of transparency.
>
> The answer would seem to be to remove all transparency from the layer at
> the outset.  I can then convert the area outside the outline to full
> transparency at a later stage.
>
> Can one of our GIMP experts tell me how I can get the result I want?
>
> David
>
>
> _______________________________________________
> Techtalk mailing list
> Techtalk at linuxchix.org
> http://mailman.linuxchix.org/mailman/listinfo/techtalk
>

-- 
If you don't have any failures then you're not trying hard enough.
  - Dr. Charles Elachi, director of NASA's Jet Propulsion Laboratory
-----
Website: http://miriam-english.org
Blogs:   http://miriam-e.dreamwidth.org
          http://miriam-e.livejournal.com





More information about the Techtalk mailing list