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

Home » Public Forums » archive » Re: Printing Images
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: Printing Images [message #2632] Mon, 08 August 1994 09:53
sbarrkum is currently offline  sbarrkum
Messages: 5
Registered: August 1994
Junior Member
In article <31qsi4$33v@reznor.larc.nasa.gov> tai@rockola.larc.nasa.gov (Alan Tai) writes:
> I'm having some problems printing an image to a Postscript device. By
> 12000 byte array. Does anyone have any suggestions? Thanks.


I use a little routine to rescale the pixels according to the device.
PS devices are capbale of high pixel density but the pixels can be rescaled.
Hence can makedo with less pixels.

pro mak_plot, x1,y1,x2,y2

; x1, y1 Bottom left Normalised coordinates
; x2, y2 Top right Normalised coordinates

data=fltarr(26,14) ; array to hold the image


;Plot image
arr_size=convert_coord(x2-x1+(x2-x1)*2/24,y2-y1+(y2-y1)*2/12 ,/Normal, /To_device)
if arr_size(0) gt 1000.0 then arr_size(0)=26.0 * 50.0 ; If array to large when
if arr_size(1) gt 700.0 then arr_size(1)=14.0 * 20.0 ; using PS device use smaller dimnsns
img=congrid(data,arr_size(0),arr_size(1))
if arr_size(0) ge arr_size(1) then smooth_width =0.1 * arr_size(1)
if arr_size(0) le arr_size(1) then smooth_width =0.1 * arr_size(0)
img=smooth(img, smooth_width)
tv, bytscl(img, tmin, tmax, top=255),x1, y1, /Normal, $
xsize = x2-x1, ysize = y2-y1


;Plot lat long grid and Manus coast line
plot,[140.5, 164.5], [-5.5,6.5], /Nodata, Xrange=[140.5, 164.5],YRange = [-5.5,6.5], $
/NOERASE, Linestyle=0, thick =3, XStyle=1 , Ystyle=1, color=backcolor, $
position=[x1,y1,x2,y2], charsize=0.6




end

===============
Hope this helps


Barr-Kumarakulasinghe
Re: Printing Images [message #2644 is a reply to message #2632] Thu, 04 August 1994 09:50 Go to previous message
sjt is currently offline  sjt
Messages: 72
Registered: November 1993
Member
Alan Tai (tai@rockola.larc.nasa.gov) wrote:
: I'm having some problems printing an image to a Postscript device. By
: using the same dimensions for the image as the X display (240 x 260),
: the plot comes out larger than it should be (weird--I kind of expected
: it to be a lot smaller). I tried re-scaling the image for the
: postscript device but ended up trying in vain to congrid a 12000 x
: 12000 byte array. Does anyone have any suggestions? Thanks.


: Alan

Let's suppose for the sake of argument you want your image to come out
10cm square on the print device and that it is in the array image, then a
suitable piece of code might be:

if ((!d.flags and 1) eq 1) then tv, image, xsize=10., ysize=10, /centi $
else tv, image

This checks if the device has scalable pixels (I think PS is currently
the only one that does, but it's as well to be general) [N.B. be careful
about the parentheses when working with !d.flags in this case it's O.K.
but for others missing them out will mess up precedences], and if the
pixels are scalable then it plots the image 10cm square, otherwise it
just plots it normally. The problem you were having is that for scalable
devices an image is by default plotted as big as possible.

--
James Tappin, School of Physics & Space Research
University of Birmingham
sjt@xun8.sr.bham.ac.uk
"If all else fails--read the instructions!"

O__
-- \/`
Re: Printing Images [message #2646 is a reply to message #2644] Thu, 04 August 1994 09:24 Go to previous message
n9140397 is currently offline  n9140397
Messages: 13
Registered: July 1994
Junior Member
In article <31qsi4$33v@reznor.larc.nasa.gov> tai@rockola.larc.nasa.gov (Alan Tai) writes:
> I'm having some problems printing an image to a Postscript device. By
> using the same dimensions for the image as the X display (240 x 260),
> the plot comes out larger than it should be (weird--I kind of expected

If you are saying device,xsize=240,ysize=260, then, yeah. I believe
that the default units for PS are cms!

That in itself should be useful, but, to fill up a page, try

set_plot,'PS'
device,/inches,xoffset=1, yoffset=1
device,/inches,xsize=6.5, ysize=9

This sets up a standard 8.5"x11" paper with one inch margins. You
can figure out the sizing you need for your case. Note that I
believe specifying landscape will exchange the x and y axes.

Hope that helps.

Mike H.
UCSD SIO CRD
Re: Printing Images [message #2649 is a reply to message #2646] Thu, 04 August 1994 09:30 Go to previous message
zawodny is currently offline  zawodny
Messages: 121
Registered: August 1992
Senior Member
In article <31qsi4$33v@reznor.larc.nasa.gov> tai@rockola.larc.nasa.gov (Alan Tai) writes:
> I'm having some problems printing an image to a Postscript device. By
> using the same dimensions for the image as the X display (240 x 260),
> the plot comes out larger than it should be (weird--I kind of expected
> it to be a lot smaller). I tried re-scaling the image for the
> postscript device but ended up trying in vain to congrid a 12000 x
> 12000 byte array. Does anyone have any suggestions? Thanks.
>
>
> Alan

Congrid the image to the size that is appropriate for the amount of detail
you wish to retain in the image (240x260 sounds like a good starting point).
Then use the fact that PostScript has scaleable pixels and TV the image using
the xsize, ysize, & /NORMAL keywords to scale the image correctly. This will
probably entail some extra code (mostly CONVERT_COORD calls) to calculate
the correct values of xsize and ysize (as well as the x and y parameters to the
TV call). I once tried to use the /DATA key to TV but this did not work as
expected (maybe it does now). It also did not work when I was using log axies.

--
Joseph M. Zawodny (KO4LW) NASA Langley Research Center
Internet: zawodny@arbd0.larc.nasa.gov MS-475, Hampton VA, 23681-0001
TCP/IP: ko4lw@ko4lw.ampr.org Packet: ko4lw@n4hog.va.usa
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Freebies & Giveaways
Next Topic: HELP!!! ^Z

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

Current Time: Sat Oct 11 09:18:32 PDT 2025

Total time taken to generate the page: 0.24179 seconds