[alt.sys.sun] 32Bit Sunraster to B&W

kuyp@wyn386.mi.org@wybbs.mi.org (kuyp@wyn386.mi.org) (06/25/91)

Help!

I am looking for a method to convert 32 Bit color Sunraster files to
Black & White Images. These Images have to look good!?

I can and have converted them to 4 eight bit images and picked the
best looking B&W, but would like a more exact way, you do not always
get a good looking image from just one color.

Anybody have any ideas?

Please let me know!

Mail me direct, I do not always get these news feeds.

Gary Kuyper

kuyp@wybbs.mi.org

thanks all!!

falk@peregrine.Sun.COM (Ed Falk) (07/01/91)

In article <620@wybbs.mi.org> kuyp@wyn386.mi.org@wybbs.mi.org (kuyp@wyn386.mi.org) writes:
>
>I am looking for a method to convert 32 Bit color Sunraster files to
>Black & White Images. These Images have to look good!?
>
>I can and have converted them to 4 eight bit images and picked the
>best looking B&W, but would like a more exact way, you do not always
>get a good looking image from just one color.

I'm confused, are you trying to get 8-bit greyscale out or 1-bit monochrome?
In the former case, the FAQ list mentions that the customary function is
	
	.299r + .587g + .144b

These numbers were invented the the NTSC (national television standards
committee?), but you can get reasonable results with just r/3 + g/3 + b/3
if you're lazy.

In a 32-bit sunraster file, the high-order byte is alpha, and can be
ignored.  The low order three bytes are either rgb (blue lowest) for
format RT_FORMAT_RGB or bgr (red lowest) for RT_STANDARD.

To convert to a 1-bit monochrome picture, first convert to greyscale
and use one of the "dithering" techniques described in Foley & VanDam.

Software to do all this can be found in the pbm and fbm packages.  See
the FAQ list.

		-ed falk, sun microsystems
		 sun!falk, falk@sun.com

In the future, somebody will quote Andy Warhol every 15 minutes.