Re: TV/postscript problem [message #13388] |
Thu, 05 November 1998 00:00 |
davidf7203
Messages: 12 Registered: August 1998
|
Junior Member |
|
|
R Balthazor <r.balthazor@sheffield.ac.uk> writes:
> I'm running a program with the general form shown below. It cycles over
> 20 timesets of two datasets, each time reading them both in and
> displaying one as a false-color image on a map projection and then
> displaying the second as a contour image overlaid on it. Each time it
> flashes up the completed image satisfactorily on the X-windows, and the
> postscript file builds up until it is 20 pages long.
>
> However, each page of the postscript file is a horrible two-tone mess of
> black and white, looking like it is an 'overexposed' photograph and
> nothing like what was on the screen; and moreover, the TV,imageset is
> larger than and displaced from the desired position.
>
> What have I done wrong?
Several things. You might want to have a look at the
section of my web page called "Producing Perfect PostScript
Output" for more detailed information. (Or you could
read the equivalent chapter in my book for even *more*
information. :-)
> I'd be very grateful for any suggestions; I presume the problem is in
> the postscript writing.
Well, most computer programs only do what they are told. :-)
> DEVICE,file='image.ps',/LANDSCAPE,XSIZE=27,YSIZE=17,$
> XOFFSET=2,YOFFSET=28.5,/TIMES,/COLOR
Here is the first problem. You seem to want color output,
but getting what you expect will be nearly impossible unless
you also set the BITS_PER_PIXEL keyword to 8.
> MAP_SET,(arguments)
> imageset1=MAP_IMAGE(dataset1,startx,starty,other arguments)
> TV,imageset1,startx,starty
> CONTOUR,dataset2,/OVERPLOT
Here is the next problem. You seem to be dismissing the
"other arguments", but I suspect that it is the misuse
(more likely non-use) of these other arguments that is
doing you in. And in particular is causing your image to
be the wrong size.
MAP_IMAGE not only returns the starting coordinates of
the image, but the size of the image. You must use
these sizes on the TV command or you image will not
be the right size on your PostScript page. The commands
should look like this:
warped = Map_Image(image, xstart, ystart, xsize, ysize)
TV, warped, xstart, ystart, XSize=xsize, YSize=ysize
And may I suggest you test your program with one image
instead of 20. It will save you some time cooling your
heels by the water cooler while the printer chugs along. :-)
Cheers,
David
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
|
|
|
Re: TV/postscript problem [message #13390 is a reply to message #13388] |
Thu, 05 November 1998 00:00  |
philip aldis
Messages: 13 Registered: October 1998
|
Junior Member |
|
|
R Balthazor wrote:
> However, each page of the postscript file is a horrible two-tone mess of
> black and white, looking like it is an 'overexposed' photograph and
> nothing like what was on the screen; and moreover, the TV,imageset is
> larger than and displaced from the desired position.
> - doing a single dataset read in case it was to do with multiple pages
> written to the postscript file - but still the horrible mess.
>
> - using CONTOUR,dataset1,/FILL as an approximation to TV,imageset1; this
> works perfectly (but I want more than 26 levels)
>
> - using WRITE_GIF; this works perfectly.
>
>
>
I'm not entirely sure if this is the problem and it may well be something a lot more
complicated than I can cope with - but I noticed that on your device, ..... you did not set
bits_per_pixel=8, failure to do this means that the postscript file can only print with 16
colours, which may have caused the problem.
A second point I noticed is to do with the colours available. When you are working on the
screen, you probably don't have all 256 colours available due to the window manager nicking
some, however in postscript there are always 256 colours available. There are two options to
correct this:
* If you want to scale the screen image to the number of colours available on the screen
and then scale the postscript output to the number of colours available there then use
TVSCL, instead of TV. This simply scales the image to the number of colours available.
* Or if you want both images to be scaled to the same value - the number of colours
available on the screen-, then after the set_plot, 'x' put scale_factor = !d.n_colors .
!d.n_colors, as you may have guessed, is simply the number of available colours. Then
when you tv the image, don't tv just the image but instead
TV, bytscl(image, top=scale_factor)
I hope this solves the problem, although there seems to be something more fundamental
because I haven't been able to explain the positioning problems or the black and white only.
I hope someone else can give you a slightly more informed answer than mine.
cheers,
Phil Aldis
|
|
|