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