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

Home » Public Forums » archive » Re: converting a gif file to a postscipt file
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: converting a gif file to a postscipt file [message #7416] Tue, 12 November 1996 00:00
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Tim Duman <t-duman@ukans.edu> writes:

> I am trying to read in a gif file and write it out to a postscript file.
> The reason being is that our color printer only prints postscript.
>
> The program I am using is at the end of the posting. The problems is
> when I write it out to the postscript file there is no color in the
> file. Can anybody help with this problem
>
> pro giftops, FILENAME=filename
>
> IF NOT KEYWORD_SET(filename) THEN READ,'Input name of file: ',filename
>
> READ_GIF, filename, image, red, green, blue
> SET_PLOT,'z'
> TVLCT, red, green, blue
> TV,image
> newimage = TVRD()
>
> strname = STR_SEP(filename,'.')
>
> SET_PLOT,'ps'
> DEVICE,FILENAME=strname(0)+'.ps',/COLOR,BITS=8
> TVLCT,red,green,blue
> TV,newimage
> DEVICE,/CLOSE
>
> END ; End program giftops.pro

What is going on here, Tim, is that you are making the PostScript
device the current device from within the Z-buffer. I am not sure
why this is causing your color problems, but it is pretty non-standard
operating procedure.

As it happens, there is no reason at all to use the Z-buffer. I would
modify your program like this. (Notice I also put some code in to
get you back to your original device. This is just friendly programming.
Very nasty to leave someone in the PostScript device where all their
graphics commands appear to disappear into the ozone!)

pro giftops, FILENAME=filename

IF NOT KEYWORD_SET(filename) THEN READ,'Input name of file: ',filename

READ_GIF, filename, image, red, green, blue
strname = STR_SEP(filename,'.')
thisDevice = !D.NAME
SET_PLOT,'ps'
DEVICE,FILENAME=strname(0)+'.ps',/COLOR,BITS=8
TVLCT,red,green,blue
TV,newimage
DEVICE,/CLOSE
SET_PLOT, thisDevice
END ; End program giftops.pro

This should work fine.

David

*************************************************
* David Fanning, Ph.D.
* 2642 Bradbury Court, Fort Collins, CO 80521
* Phone: 970-221-0438 Fax: 970-221-4762
* E-Mail: davidf@dfanning.com
*
* Sometimes I go about pitying myself, and all along my
* soul is being blown by great winds across the sky.
* -- Ojibway saying
************************************************
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: disappearing levels in CONTOUR
Next Topic: Spectrogram.pro for 2D spectrograms

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

Current Time: Wed Oct 08 20:00:58 PDT 2025

Total time taken to generate the page: 0.00664 seconds