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

Re: Colour tables



Charles Kilburn (C.Kilburn@rl.ac.uk) writes:

> Does anyone know how to save a colour table that you have made in
> XPALETTE? Using MODIFYCT seems to be the only way, but it needs 256
> element vectors, and R_ORIG, R_CURR etc. are only 235 elements under
> Windows. Loading colour tables made with them leaves a band of 20 odd
> white colours at the top.

The easiest way to save a color table, probably, is with
the SAVE command:

   TVLCT, r, g, b, /Get
   colors = Transpose([[r], [g], [b]])
   SAVE, File='mycolors.sav', colors

Then, when you need it:

   RESTORE, 'mycolors.sav'
   TVLCT, colors

This is best if you want to retain specific colors at
specific index numbers.

Or, if your color table contains smooth graduations in color,
you can always use the good ol' Congrid command:

   TVLCT, r, g, b, /Get
   ModifyCT, 41, 'mycolors', Congrid(r, 256, /Interp), $
      Congrid(g, 256, /Interp), Congrid(b, 256, /Interp)

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