On Mon, 2021-08-16 at 09:22 +0700, Rijal Asep Nugroho wrote:
> I was browsing how to make a golang code to convert an image to pure
> black and white, but didn't find a suitable one, only got how to
> convert the image to grayscale.
> Can anyone help? thank you.

If you do a greyscale conversion and then threshold on a level of grey
that is bright enough to be white/dark enough to be black, that's
monochrome.


https://github.com/ev3go/ev3dev/blob/a5fda5c6a492269e01b184046ed42dc4a1dfe8c9/fb/mono.go#L106-L113
.

I don't recall where I got the constants from, but I think they are
reasonably commonly used (you could just use the image/color
constants).

Dan


-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/77a7206148474c6123e9fc71f1a6aedf1f9326b6.camel%40kortschak.io.

Reply via email to