Re: color_quan & gif files [message #16487] |
Thu, 29 July 1999 00:00 |
Liam Gumley
Messages: 473 Registered: November 1994
|
Senior Member |
|
|
Simon Hall wrote:
> I'm producing a lot of images that will eventually end up on a web
> page, so I'm generating .gif files. I'm also using a 24 bit display
> so my code is something like this:
>
> set_plot, 'win'
> device, decomposed = 0
>
> <do plot here>
>
> tvlct, r, g, b, /get
> write_gif, filename, color_quan(tvrd(/true), 1, r, g, b), r, g, b
>
> (All this courtesy of dfanning.com, thanks David)
>
> I do get valid gif files but color_quan seems to alter the colours a
> little. Most noticably, the white background is now light grey
> ([248,248,248] rather than [255,255,255]). Not a big difference but
> immediately obvious against a white background.
Here's a hack which changes any color table entries with R,G,B values
greater than 245 to white:
image = color_quan(tvrd(/true), 1, r, g, b, colors=256)
value = 245
index = where((r gt value) and (g gt value) and (b gt value), count)
if count gt 0 then begin
r[index] = 255B
g[index] = 255B
b[index] = 255B
endif
write_gif, filename, image, r, g, b
Cheers,
Liam.
--
Liam E. Gumley
Space Science and Engineering Center, UW-Madison
http://cimss.ssec.wisc.edu/~gumley
|
|
|
Re: color_quan & gif files [message #16488 is a reply to message #16487] |
Thu, 29 July 1999 00:00  |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
Simon Hall (Simon.Hall@atm.ch.cam.ac.uk) writes:
> I'm producing a lot of images that will eventually end up on a web
> page, so I'm generating .gif files. I'm also using a 24 bit display
> so my code is something like this:
>
> set_plot, 'win'
> device, decomposed = 0
>
> <do plot here>
>
> tvlct, r, g, b, /get
> write_gif, filename, color_quan(tvrd(/true), 1, r, g, b), r, g, b
>
> (All this courtesy of dfanning.com, thanks David)
Ah, shucks...
> I do get valid gif files but color_quan seems to alter the colours a
> little. Most noticably, the white background is now light grey
> ([248,248,248] rather than [255,255,255]). Not a big difference but
> immediately obvious against a white background.
A couple of quick questions before I make a stab at an
answer:
1. Are you certain you are in 24-bit color and not
16-bit color?
2. Why do you think the white background is gray? :-)
I guess I am asking, where are you viewing these GIF
images? If you read them into IDL after writing them,
do they look OK? What about displaying them in Photoshop?
If you are viewing them in a browser, which one, specifically?
Thanks,
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
|
|
|