How do I create an image mask from a colored Java/.NET image?

Q: Does PDFtron has any method available for loading and converting a
colored GIF file to 1bit(bilevel) Black and White mask image. The
masking works fine (i.e. pdftron.PDF.Image.SetImageMask() etc) if I
specify a predefined byte array of mask and create a 1bpc image in
devicegray and use it as a mask. However from a colored GIF file
loaded as java BufferedImage, how do I get a B&W mask image with 1bpc
in devicegray.
----
A: PDFNet does not contain built-in functions to manipulate raster
images (e.g. to convert a Java/.NET image to a monochrome image etc).
If you search the Net you will probably find some sample code showing
how to convert BufferedImage to 1 pit per pixel image. For example,
the following sample is for C#/, but it can be easily translated to
Java:

"Converting an RGB image to 1 bit-per-pixel monochrome"
http://www.bobpowell.net/onebit.htm