[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: writing gray scale GIFs from a 24bit machine

Brian Reardon (reardonb@my-deja.com) writes:

> I'm having trouble creating gray scale GIF images that accurately
> reflect what is on my screen.  I'm using a Mac and this problem does not
> exist when the colors are set to 256 but if the colors are set to
> thousands or millions I get a saved GIF image that has one color band
> that should be almost black but is instead almost white.  I get this
> problem for gray scale color pallets such as loadct, 0.   If I set the
> color pallet to loadct, 39 the saved GIF is very much like the screen
> image.  The code I am using is the one David Fanning suggested and is
> attached below.  I would like for this code to work on any system with
> any color pallet and any monitor color setting.  Any help would be
> appreciated.

There are two algorithms that can be used with Color_Quan.
The method I used in the code you were following produces
the best results when there are lots of colors in the image.
When you are producing gray-scale GIFs, you may get better
results using the alternative Floyd-Steinburg method, which 
is selected by using the CUBE keyword. For example, like this:

   image2d = Color_Quan(image24, 1, r, g, b, Cube=6)

You can find more details in this article on my web page:



David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155