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

writing gray scale GIFs from a 24bit machine



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.