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

Home » Public Forums » archive » Write PNG from plots with different 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
Write PNG from plots with different color tables?? [message #69873] Tue, 02 March 2010 10:51 Go to next message
Mark Shephard is currently offline  Mark Shephard
Messages: 13
Registered: July 1999
Junior Member
Hi all,

I need help! This should be very simple, but I cannot seem to find a
solution. I have having problems with the fact that I have two plots
using two different color tables that I would like to write into one
png file, but, write_png that only accepts one color table. Here is
an example outline:

set_plot, 'z'
;; load color table
loadct, 0
tvlct, r, g, b, /get

!P.BACKGROUND = 255 ;white

;;plot simple x,y plot
plot, x, y, color=1

;;read in gif image and colors
read_gif, image_gif, r_gif, g_gif, b_gif
TVLCT, r_gif, g_gif, b_gif

;;plot gif image
TVSCL, image_gif, 0.85,0.035, /normal

image = tvrd()
write_png, file_out, image, r, g, b

As you can see I have used two r,g,b, color palletes generating the
plots : r,g,b (black and white plot) and r_gif, g_gif, b_gif (from
gif image). This is fine until I need to generate a png file that
only takes one color table.

Any helpful tips?...Merge color tables? Somehow force both plots to
just the same color table (..no keyword option for read_gif)?

Thanks,
Mark
Re: Write PNG from plots with different color tables?? [message #70001 is a reply to message #69873] Wed, 03 March 2010 13:17 Go to previous message
penteado is currently offline  penteado
Messages: 866
Registered: February 2018
Senior Member
Administrator
On Mar 3, 4:48 pm, David Fanning <n...@dfanning.com> wrote:
> As excited as I am about IDL 8.0, I really worry about
> what it is going to take to move a ton of IDL programmers
> out of the 1970s. Retirement, I suppose. :-(

I am afraid that will not be enough. Because when they retire they
leave behind the next generation, trained by them to keep doing the
same old things, under the principle that "that way does the job".

Just like typewriters, vinyl records, and horse carriages do their
job.
Re: Write PNG from plots with different color tables?? [message #70006 is a reply to message #69873] Wed, 03 March 2010 11:48 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Mark Shephard writes:

> THAT WORKS!!!
>
> Thank you very much for all the help.
>
> I set:
> DEVICE, set_pixel_depth=24
> TVRD(true=1)
>
> David Fanning explaination of TVRD issues was also very helpful. I
> also tried his TVREAD(), but it had the same issue as TVRD()....until
> I set the pixel depth in the device. This might be due to the fact
> that I am using the Z-buffer.

As excited as I am about IDL 8.0, I really worry about
what it is going to take to move a ton of IDL programmers
out of the 1970s. Retirement, I suppose. :-(

Cheers,

David



--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: Write PNG from plots with different color tables?? [message #70011 is a reply to message #69873] Wed, 03 March 2010 11:16 Go to previous message
Mark Shephard is currently offline  Mark Shephard
Messages: 13
Registered: July 1999
Junior Member
On Mar 3, 10:14 am, "ben.bighair" <ben.bigh...@gmail.com> wrote:
> On Mar 2, 2:30 pm, Mark Shephard <mark.w.sheph...@gmail.com> wrote:
>
>
>
>
>
>> Hi PP,
>
>> Thanks for the prompt response.  I had already tried what you
>> suggested.  When I do so I get a very strange result.  The top half is
>> completely black and the bottom half has the plot repeated three times
>> (still using just one of the color tables).
>
>> ----------------
>> |              |
>> |  BLACK       |
>> |              |
>> ----------------
>> |              |
>> | P1   P1   P1 |
>> |              |
>> ----------------
>
>> Any thoughts?
>
>> Thanks,
>> Mark
>
>> On Mar 2, 2:06 pm, pp <pp.pente...@gmail.com> wrote:
>
>>> On Mar 2, 3:51 pm, Mark Shephard <mark.w.sheph...@gmail.com> wrote:
>
>>>> image = tvrd()
>>>> write_png, file_out, image, r, g, b
>
>>> Do it without color tables instead:
>
>>> image=tvrd(true=1)
>>> write_png,file_out,image
>
> Hi,
>
> What happens if you use David Fanning's handy TVREAD rather than IDL's
> built-in TVRD?
>
> http://dfanning.com/color_tips/strange_tvrd.html
>
> Ben- Hide quoted text -
>
> - Show quoted text -


Hi Guys,

THAT WORKS!!!

Thank you very much for all the help.

I set:
DEVICE, set_pixel_depth=24
TVRD(true=1)

David Fanning explaination of TVRD issues was also very helpful. I
also tried his TVREAD(), but it had the same issue as TVRD()....until
I set the pixel depth in the device. This might be due to the fact
that I am using the Z-buffer.

Thanks again for all the help,
Mark
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Generalized Extreme Value Distribution?
Next Topic: Re: IDLgrPolygon Leak?

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

Current Time: Sun Oct 12 02:04:01 PDT 2025

Total time taken to generate the page: 2.48124 seconds