Hi,
I'm trying to make all white pixels below a certain threshold white.
I scanned some pages from a book and there are some not-quite-white pixels, that I want to make true white.
I can do this in another image app by using the wand tool with a 20% threshold, then cutting everything and pasting it onto a clean white page.
But I need to do it on a large number of images, so I am hoping to batch process it with IM instead.
Using ImageMagick-7.0.5-4-Q16-x64-dll.exe In Windows 7.
Kind regards,
Brad
EDIT: Essentially what I am doing is cutting the text off of a page and pasting it onto a white page if that makes more sense.
make all pixels below a certain threshold white? [solved]
make all pixels below a certain threshold white? [solved]
Last edited by BradLee on 2017-04-18T05:24:45-07:00, edited 2 times in total.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: make all pixels below a certain threshold white?
Are you sure you do not want to make all pixels above a certain graylevel into white to even out all the (near-) white areas. If that is the case, then try
Where XX% is the percent graylevel value near white. So 80% would make gray(80%) and above into pure white.
If this is not what you want, then please post an example image to some place such as dropbox.com and put the URL here and explain what regions you want white.
Code: Select all
magick image -white-threshold XX% result
If this is not what you want, then please post an example image to some place such as dropbox.com and put the URL here and explain what regions you want white.
Re: make all pixels below a certain threshold white?
But isn't white 0, and black 255?
Anyhow, your suggestion of this works:
Code: Select all
magick image -white-threshold XX% result
That is what I wanted, thank you.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: make all pixels below a certain threshold white?
White is gray(100%) or gray(255) or gray100. Black is gray(0%) or gray(0) or gray0.But isn't white 0, and black 255?
Re: make all pixels below a certain threshold white?
I was referring to absolute white and black, but nevermind it seems that I have mixed the two up.
Black being #000, white being #FFF
Black being #000, white being #FFF
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: make all pixels below a certain threshold white?
The above hex values are correct.
Do you mean opacity vs transparency? If you have an alpha channel, white will correspond to fully opaque and black will correspond to fully transparent.
Re: make all pixels below a certain threshold white?
@fmw42,
As I already explained, I had the white and black values mixed up the wrong way around.
In my mind I thought that WHITE was #000, and BLACK was #FFF
As I already explained, I had the white and black values mixed up the wrong way around.
In my mind I thought that WHITE was #000, and BLACK was #FFF