Page 1 of 1

Set certain pixels black, leave others alone

Posted: 2017-09-04T14:06:16-07:00
by sizzzzlerz
From the recent eclipse, I have some images of the partially eclipsed sun showing up in orange on an almost black background. What I'd like to do is set the almost black pixels to fully black while leaving the orange image of the sun unchanged. Basically, if all RGB channels of a pixel have a value between 0 and N, I want that pixel to be set to (0,0,0). If any channel has a value greater than N, the pixel should remain unmodified. I need to experiment to determine a good value of N. I've played with -channel and -threshold a bit but haven't found the correct recipe. Is there one which will do what I want?

Re: Set certain pixels black, leave others alone

Posted: 2017-09-04T15:04:11-07:00
by fmw42
You could try -black-threshold. See http://www.imagemagick.org/script/comma ... -threshold. You may have to do it channel by channel using -channel. Also it uses either percent or pixel values in the range 0 to quantumrange for your compile of ImageMagick. (Q8 is 0 to 255, Q16 is 0 to 65535)

Please, always provide your IM version and platform when asking questions, since syntax may differ. Also provide your exact command line and if possible your images.

See the top-most post in this forum "IMPORTANT: Please Read This FIRST Before Posting" at viewtopic.php?f=1&t=9620

For novices, see

viewtopic.php?f=1&t=9620
http://http://www.imagemagick.org/scrip ... essing.php
http://www.imagemagick.org/Usage/reference.html
http://www.imagemagick.org/Usage/