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
|
|
|