Also, presumably this solution will threshold the grayscale image at 128
(assuming an 8-bit grayscale), so you might want to apply a thresholding
LookupOp to (a copy of) the original grayscale image before rendering it
into the bitmap, if you need a different threshold.

Question: will setting the KEY_DITHERING rendering hint make any difference
to the way pixmaps are drawn into bitmaps?

Cheers,
Pete

----- Original Message -----
From: Jeannette Hung <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: June 07, 1999 3:38 PM
Subject: Re: [java2d] Transform grayscale image into bnary


> You should be able to draw into the binary image.  For example:
> BufferedImage binary = new BufferedImage(width, height,
>                                         BufferedImage.TYPE_BYTE_BINARY);
>   Graphics2D g2d = binary.createGraphics();
>   g2d.drawImage(grayscaleImage, 0, 0, this);
>
> I think there are some bugs with binary images in JDK1.2 so I'm not
> sure that this will work in all cases.
>
> jeannette


=====================================================================
To subscribe/unsubscribe, send mail to [EMAIL PROTECTED]
Java 2D Home Page: http://java.sun.com/products/java-media/2D/

Reply via email to