comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: writing gray scale GIFs from a 24bit machine
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: writing gray scale GIFs from a 24bit machine [message #18781] Mon, 07 February 2000 00:00
reardonb is currently offline  reardonb
Messages: 16
Registered: December 1999
Junior Member
Liam,
I installed your saveimage.pro program and it is working great. Thanks!
Unfortunately, I do not fully understand what I was doing wrong. Could
you enlighten me? Thanks.
-Brian

In article <87fnvl$ev$1@nnrp1.deja.com>,
reardonb@my-deja.com wrote:
> Hi,
> 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.
> Thanks.
> -Brian
>
> device, decomposed=0
> loadct, 0, ncolors=20, bottom=0
> wset, info.wid
> device, Get_visual_depth=thisdepth
> if thisdepth gt 8 then begin
> image24=TVRD(True = 1)
> snapshot=color_quan(image24,1,r,g,b)
> endif else begin
> snapshot = tvrd()
> tvlct, r, g, b, info.bottom, /get
> endelse
> write_gif,filename+'.gif',snapshot, r, g, b
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>


Sent via Deja.com http://www.deja.com/
Before you buy.
Re: writing gray scale GIFs from a 24bit machine [message #18800 is a reply to message #18781] Sat, 05 February 2000 00:00 Go to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
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:

http://www.dfanning.com/tips/gif_gray.html

Cheers,

David
--
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
Re: writing gray scale GIFs from a 24bit machine [message #18807 is a reply to message #18800] Sat, 05 February 2000 00:00 Go to previous message
Liam E. Gumley is currently offline  Liam E. Gumley
Messages: 378
Registered: January 2000
Senior Member
<reardonb@my-deja.com> wrote in message news:87fnvl$ev$1@nnrp1.deja.com...
> 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.

Try SAVEIMAGE, which can be found at
http://cimss.ssec.wisc.edu/~gumley/imagetools.html

Let me know if you have any problems.

Cheers,
Liam.
http://cimss.ssec.wisc.edu/~gumley
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Not where
Next Topic: Re: IDL and mkdir

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 19:05:51 PDT 2025

Total time taken to generate the page: 0.00604 seconds