1

I have a grayscale image in Gimp. I need to blacken all the least bright parts and only keep those that are above certain brightness threshold. For example, initially all grayscale pixels lie within 0-255 range of brightness. Those that are, say, below 128 need to become black and those that are above 128 need to stay intact.

How can I do it in Gimp?

2
  • Do you actually mean greyscale? Black & white only has two values, 0 & 255.
    – Tetsujin
    Oct 18, 2020 at 10:39
  • 1
    Sorry, I of course meant grayscale
    – Max Smith
    Oct 18, 2020 at 10:50

2 Answers 2

2

With the Curves tool:

  1. Set to "Freehand"
  2. With the pen that appears, draw a line along the bottom edge (you can even stay a bit below) from the left corner up to the threshold value, to make a step in the diagonal.

enter image description here

0

You can accomplish such a task in a lot of ways in Gimp (even if I'd prefer to use ImageJ or ImageMagick to play with pixel values), for example using the Level tool or the Select By Color tool.

A quick way is select all the pixels within the range you are interested and fill them with black.

Starting from the original image:

Starting image

You can use Select By Color tool (see also this way) setting the preferred threshold (128 in your example), unchecking Antialiasing and Feather edge, and clicking on a black pixel:

Select by color

Using the bucket fill, fill the selection with a black value and obtain the desired image:

Final image

Note that the histogram now is flat for the gray values from 1 to 128, because they are set to 0.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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