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

Home » Public Forums » archive » Re: Display Gifs, each w/diff color tables?
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: Display Gifs, each w/diff color tables? [message #16239] Tue, 13 July 1999 00:00
Liam Gumley is currently offline  Liam Gumley
Messages: 473
Registered: November 1994
Senior Member
rmlongfield@my-deja.com wrote:
> read_gif,'./GIF_FILES/test1.gif',image,r,g,b
> tvlct,r,g,b
> window,/free, retain=2
> tv,bytscl(image)
> read_gif,'./GIF_FILES/test2.gif',image,r,g,b
> tvlct,r,g,b
> window,/free, retain=2
> tv,bytscl(image)
> read_gif,'./GIF_FILES/test3.gif',image,r,g,b
> tvlct,r,g,b
> window,/free, retain=2
> tv,bytscl(image)

Rose,

Please try the following:

1. If you are sitting at the SGI console, logout, then log back in.

2. Start a new IDL session, and enter the following:
print, !d.n_colors, !d.table_size
device, true=24, decomposed=0, retain=2
window, /free, /pixmap
wdelete, !d.window
print, !d.n_colors, !d.table_size

3. Try displaying a couple of GIFS using this method:
read_gif, './GIF_FILES/test1.gif', image, r, g, b
tvlct, r, g, b
window, /free
tv, image ; NO BYTSCL!

Please let us know if it works.

Cheers,
Liam.

--
Liam E. Gumley
Space Science and Engineering Center, UW-Madison
http://cimss.ssec.wisc.edu/~gumley
Re: Display Gifs, each w/diff color tables? [message #16240 is a reply to message #16239] Tue, 13 July 1999 00:00 Go to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Rose (rmlongfield@my-deja.com) writes:

> I'm beginning to hum Bruce Springsteen's song: "52 channels
> and nothing on". My 24 colors must be brain-dead. I follow exactly
> what David said in a previous post. The first line of my startup file
> I have written: print!d.n_colors and I get 256. However, once I input
> the lines that David said, I get the promised 16777216. Then I run:
> @idlsave.sav , which is the following lines:
>
>
> read_gif,'./GIF_FILES/test1.gif',image,r,g,b
> tvlct,r,g,b
> window,/free, retain=2
> tv,bytscl(image)
> read_gif,'./GIF_FILES/test2.gif',image,r,g,b
> tvlct,r,g,b
> window,/free, retain=2
> tv,bytscl(image)
> read_gif,'./GIF_FILES/test3.gif',image,r,g,b
> tvlct,r,g,b
> window,/free, retain=2
> tv,bytscl(image)
>
> The "crazy colors" I referred to earlier looks to me like the color
> table is over-written and the new colors are being loaded into the
> previously plotted image (which should not happen, according to the
> rules).

Actually, I think the "crazy colors" are coming from the
BYTSCL command. These GIF files should definitely *NOT*
be byte scaled!

Just TV the image and I think you will be fine. :-)

If not, please let use know the results of these two
commands after you open a graphics window:

Device, Get_Visual_Name=thisName, Get_Visual_Depth=thisDepth
Print, thisName, thisDepth

Or, on older versions of IDL:

Help, /Device

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: Display Gifs, each w/diff color tables? [message #16242 is a reply to message #16239] Tue, 13 July 1999 00:00 Go to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Liam Gumley (Liam.Gumley@ssec.wisc.edu) writes:

> Sorry to contradict, but my frame tools work perfectly well in 8-bit or
> 24-bit mode, and they do not rely on any kind of startup file. Please
> feel free to give them a try at
> http://cimss.ssec.wisc.edu/~gumley/frame.html

Whoops! Sorry, Liam. I know better than to post answers
before I test them. I renew my test-before-posting pledge. :-)

> I believe that my original reply effectively gave the same advice, but
> apparently it did not work for Rose. Rose, could you elaborate a little
> on the 'crazy colors' behavior? And also, did you try the examples David
> and I posted *immediately* after starting a new IDL session, before
> opening any graphics windows?

Indeed. I think my advice was *identical* to yours,
except that I wanted to be sure Rose was in a 24-bit
TrueColor environment. There can only be three reasons
for window colors to change when you load a color table:

1. You are in an 8-bit PseudoColor environment.

2. You are in a 24-bit DirectColor environment.

3. You didn't follow the directions Liam and I sent
*exactly* as we gave them to you. :-) But it *can't*
happen in a 24-bit TrueColor environment.

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: Display Gifs, each w/diff color tables? [message #16243 is a reply to message #16239] Tue, 13 July 1999 00:00 Go to previous message
rmlongfield is currently offline  rmlongfield
Messages: 68
Registered: August 1998
Member
Hi All,
I'm beginning to hum Bruce Springsteen's song: "52 channels
and nothing on". My 24 colors must be brain-dead. I follow exactly
what David said in a previous post. The first line of my startup file
I have written: print!d.n_colors and I get 256. However, once I input
the lines that David said, I get the promised 16777216. Then I run:
@idlsave.sav , which is the following lines:


read_gif,'./GIF_FILES/test1.gif',image,r,g,b
tvlct,r,g,b
window,/free, retain=2
tv,bytscl(image)
read_gif,'./GIF_FILES/test2.gif',image,r,g,b
tvlct,r,g,b
window,/free, retain=2
tv,bytscl(image)
read_gif,'./GIF_FILES/test3.gif',image,r,g,b
tvlct,r,g,b
window,/free, retain=2
tv,bytscl(image)

The "crazy colors" I referred to earlier looks to me like the color
table is over-written and the new colors are being loaded into the
previously plotted image (which should not happen, according to the
rules). And that is why the colors change. They do not flash when I
move the mouse. They change when I type the TVLCT command.
The color vectors are completely different for each image.
I didn't make these images and they come from different people with
different computers. I'm going to try to send these programs home
where I have a PC and idl demo (which is only 5.0 but I hope will work.)

Until tomorrow,
Rose



Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
Re: Display Gifs, each w/diff color tables? [message #16244 is a reply to message #16239] Tue, 13 July 1999 00:00 Go to previous message
Liam Gumley is currently offline  Liam Gumley
Messages: 473
Registered: November 1994
Senior Member
David Fanning wrote:
> Rose (rmlongfield@my-deja.com) writes:
>> I forgot to mention that I do have 24-bit colors.
>
> Oh, well, then. In that case, I think you must
> have your 24-bit display in brain-dead mode.
> I'm going to guess you used Liam's setup file to
> run his FRAME tool. His setup file puts a 24-bit
> machine in an 8-bit PseudoColor mode, which sort of
> defeats the purpose of a 24-bit color display.

Sorry to contradict, but my frame tools work perfectly well in 8-bit or
24-bit mode, and they do not rely on any kind of startup file. Please
feel free to give them a try at
http://cimss.ssec.wisc.edu/~gumley/frame.html

> Try this:
>
> 1. Before you open *any* graphics windows in IDL
> (check your startup file to be sure it doesn't open
> a pixmap graphics window), type this command:
>
> Device, True=24, Decomposed=0

I believe that my original reply effectively gave the same advice, but
apparently it did not work for Rose. Rose, could you elaborate a little
on the 'crazy colors' behavior? And also, did you try the examples David
and I posted *immediately* after starting a new IDL session, before
opening any graphics windows?

Cheers,
Liam.

--
Liam E. Gumley
Space Science and Engineering Center, UW-Madison
http://cimss.ssec.wisc.edu/~gumley
Re: Display Gifs, each w/diff color tables? [message #16246 is a reply to message #16239] Tue, 13 July 1999 00:00 Go to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Rose (rmlongfield@my-deja.com) writes:

> I forgot to mention that I do have 24-bit colors.

Oh, well, then. In that case, I think you must
have your 24-bit display in brain-dead mode.
I'm going to guess you used Liam's setup file to
run his FRAME tool. His setup file puts a 24-bit
machine in an 8-bit PseudoColor mode, which sort of
defeats the purpose of a 24-bit color display.

Try this:

1. Before you open *any* graphics windows in IDL
(check your startup file to be sure it doesn't open
a pixmap graphics window), type this command:

Device, True=24, Decomposed=0

2. Now you will be using a 24-bit TrueColor visual.
Confirm it by typing this:

Device, Get_Visual_Name=thisVisual, Get_Visual_Depth=thisDepth
Print, thisVisual, thisDepth

Or, if you have an older version of IDL:

Help, /Device

In this mode you can display as many images as you
like with as many color tables as you can dream up.
They will all exist simultaneously on your display.
Simply load the color table associated with an image
and display the image. (Be *sure* you set color
decomposition OFF.) Loading the second (any any
subsequent) color table will NOT affect any of the
image colors that are previously on the display.

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: Display Gifs, each w/diff color tables? [message #16247 is a reply to message #16239] Tue, 13 July 1999 00:00 Go to previous message
steinhh is currently offline  steinhh
Messages: 260
Registered: June 1994
Senior Member
In article <MPG.11f455e18517a391989820@news.frii.com>
davidf@dfanning.com (David Fanning) writes:
[...]
> So, here is what I would do, assuming that the GIF files
> really only do use a handful of colors each. I'd create
> color separations of the GIF image, just as if you were
> going to create 24-bit JPEG images, for example:
>
> http://www.dfanning.com/tips/jpeg.html
>
> Then, I would take these 24-bit images and I would pass them
> through COLOR_QUAN, but I would use the COLORS keyword and
> restrict the number of output colors to something like 16 or
> so. Then, I would use the split color table method you
> tried previously, but now using the color table vectors
> you get back from COLOR_QUAN. If all goes well, that should
> work, although I have definitely NOT tried it just now.

Yes, David, I think this is the way to go. One possible
improvement, however, would be to bundle all the 24-bit
images together in (3) single array(s) before passing them
to color_quan. Then, you'd get a ready-made color table for
use with all the images at once. If some or all your images
are using identical colors, this method will save you a
lot of slots in the color table.

Regards,

Stein Vidar
Re: Display Gifs, each w/diff color tables? [message #16248 is a reply to message #16239] Tue, 13 July 1999 00:00 Go to previous message
rmlongfield is currently offline  rmlongfield
Messages: 68
Registered: August 1998
Member
In article <7mdadu$ppb$1@nnrp1.deja.com>,
rmlongfield@my-deja.com wrote: (see previous post)

I forgot to mention that I do have 24-bit colors. This doesn't show up
in the !version structure.

Thanks Liam, for your suggestion. I was actually trying to display
these GIF files with your FRAME tool and getting all sorts of crazy
colors. Unfortunately, your suggestion produced the same problems.

Yes, DWF, I also thought that with 256*256*256 colors that I could also
get as many different color tables displayed as I wish.
Anyway, I tried what Liam suggested and it works for a few files
(probably made on the same computer) but not all of them.
Here is how I have been trying to track this problem:

> I use: read_gif,'./GIF_FILES/file.gif',image,r,g,b
> and get: IDL> help,r,g,b
R BYTE = Array[256]
G BYTE = Array[256]
B BYTE = Array[256]

> I look at the values with:
FOR i=0L,N_ELEMENTS(r) -1L DO BEGIN
print,i,r[i],g[i],b[i],FORMAT='(i6,i6,i6,i6)'
ENDFOR

What I see is three columns of numbers filled. My first image has
numbers in the first 13 rows. My second image has the first 9 rows and
the last 10 filled. When I display this image, the colors in the first
image change also. My next image has only an array size of 64 for the
rgb vector. The next image has numbers in ALL of the 256 columns!.
(This is bizaar because when I look at image info with XV, it gets only
3 colors) If I understand this correctly (and I suspect that I don't),
especially with this last one, the new colors are affecting the colors
defined in the other gif images.

I thought that with 24 bit colors that this would not be a problem.
David, I was looking at the color_quan function with curiosity yesterday
but wasn't sure how I could use it. Do I have to make a jpeg image from
the gif file and then display it as a jpeg file? Perhaps this gives me
more control of the colors.
Well, for the moment I am just going to use SPAWN,'xv file.gif'
which is hardly a solution but will do for now.

Sigh. Lighting candles is likely to set off the fire alarm in the
building and get me into trouble.

Rose


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
Re: Display Gifs, each w/diff color tables? [message #16250 is a reply to message #16239] Mon, 12 July 1999 00:00 Go to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Rose (rmlongfield@my-deja.com) writes:

> Here's a question I haven't seen discussed yet. I have several
> different GIF files given to me by several sources. I can read and
> display them individually. However, I can't look at them all at the same
> time. This is, I believe, due to the fact that the GIF files come with
> their own color tables. Every time a new one is loaded, the color table
> from the previous one is re-defined. I have tried the
> "split table" technique outlined in DWF's book, but it doesn't work
> because some of the GIF images fill in all the r,g,b arrays.
>
> Now, these are just xy plots and clearly all these colors are
> not necessary. Is there some way of defining which colors are important
> and which are just "pretty"? Maybe a reverse color24 function (DWF)?

Well, as Liam points out, if you had a 24-bit color display
things would be easy. But I'm guessing that if you had a
24-bit color display, you wouldn't be needin' us. :-)

So, here is what I would do, assuming that the GIF files
really only do use a handful of colors each. I'd create
color separations of the GIF image, just as if you were
going to create 24-bit JPEG images, for example:

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

Then, I would take these 24-bit images and I would pass them
through COLOR_QUAN, but I would use the COLORS keyword and
restrict the number of output colors to something like 16 or
so. Then, I would use the split color table method you
tried previously, but now using the color table vectors
you get back from COLOR_QUAN. If all goes well, that should
work, although I have definitely NOT tried it just now.

I guess it wouldn't hurt to make a sacrifice and light
a candle for the programming gods before you start coding
it up, too. Or, you could put the money for the candle
into the fund for the 24-bit display. :-)

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: Display Gifs, each w/diff color tables? [message #16252 is a reply to message #16250] Mon, 12 July 1999 00:00 Go to previous message
Liam Gumley is currently offline  Liam Gumley
Messages: 473
Registered: November 1994
Senior Member
Liam Gumley wrote:
> If you have a 24-bit display, try this in a new IDL session:
>
> ;- Set display to 24-bit decomposed mode
> device, true=24, decomposed=0, retain=2
> if !d.n_colors le 256 then message, '24-bit mode unavailable' <<<< ERROR!

I forgot that !d.n_colors is always 256 before you open a window. Just
remove this line, and it should work (if you have 24 bit graphics). Or,
move it *after* the WINDOW command.

Note to self: test all code examples before posting.

--
Liam E. Gumley
Space Science and Engineering Center, UW-Madison
http://cimss.ssec.wisc.edu/~gumley
Re: Display Gifs, each w/diff color tables? [message #16253 is a reply to message #16252] Mon, 12 July 1999 00:00 Go to previous message
Liam Gumley is currently offline  Liam Gumley
Messages: 473
Registered: November 1994
Senior Member
rmlongfield@my-deja.com wrote:
> Here's a question I haven't seen discussed yet. I have several
> different GIF files given to me by several sources. I can read and
> display them individually. However, I can't look at them allat the same
> time. This is, I believe, due to the fact that the GIF files come with
> their own color tables. Every time a new one is loaded, the color table
> from the previous one is re-defined. I have tried the
> "split table" technique outlined in DWF's book, but it doesn't work
> because some of the GIF images fill in all the r,g,b arrays.

Rose,

If you have a 24-bit display, try this in a new IDL session:

;- Set display to 24-bit decomposed mode
device, true=24, decomposed=0, retain=2
if !d.n_colors le 256 then message, '24-bit mode unavailable'

;- Open a window
window, /free, xsize=950, ysize=700

;- Display the first GIF
read_gif, 'file1.gif', image, r, g, b
tvlct, r, g, b
tv, image, 0, 0

;- Display the second GIF
read_gif, 'file2.gif', image, r, g, b
tvlct, r, g, b
tv, image, 475, 0

Cheers,
Liam.

--
Liam E. Gumley
Space Science and Engineering Center, UW-Madison
http://cimss.ssec.wisc.edu/~gumley
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: RedHat 6.0 and IDL 5.2
Next Topic: RedHat 6.0 and IDL 5.2

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

Current Time: Wed Oct 08 17:06:53 PDT 2025

Total time taken to generate the page: 0.01250 seconds