TVSIZE Procedure
Displays or prints images at the current or specified size and device resolution.
Usage
TVSIZE, image[, x, y[, channel ]]
TVSIZE, image[, position]
Input Parameters
image—A 2D array containing the image data.
x, y—(optional) The lower-left position of the displayed image.
channel—(optional) The memory channel to be written. If not specified, it is assumed to be zero. This parameter is ignored on display systems that have only one memory channel.
position—(optional) A number specifying the position of the image. Positions run from the left of the window to the right, and from the top of the window to the bottom.
Keywords
Bottom—Specifies that the image intensity values are to be scaled (as with the TVSCL procedure). The value specified is the lower bound of the intensity values.
Centimeters—If present and non-zero, specifies that the XSize and YSize keyword parameters are in centimeters. This is the default.
Channel—The memory channel to be written. This keyword is identical to the channel input parameter; only one needs to be used.
Data—If present and non-zero, specifies the (x, y) position parameters are in data coordinates.
Device—If present and non-zero, specifies the (x, y) position parameters are in device coordinates.
Inches—If present and non-zero, specifies that the XSize and YSize keyword parameters are in inches. (Default: centimeters)
Normal—If present and non-zero, specifies the (x, y) position parameters are in normal coordinates.
Order—If specified, overrides the current setting of the !Order system variable for the current image only. If nonzero, Order causes the image to be drawn from the top-down, instead of from the bottom-up (the default).
Resize_Device—If present and non-zero, resizes the output device to match the size of the image. This keyword is ignored when the current device is a screen device, such as X or WIN32. See the Discussion section for more information.
Top—Specifies that the image intensity values are to be scaled (as with the TVSCL procedure). The value specified is the upper bound of the intensity values.
Screen_Dpi—Specifies the resolution of the screen in dots per inch. Default: 100 dpi.
XSize—Specifies the width of the displayed (or printed) image. The default is to display it with the same width it would have if displayed on the screen.
YSize—Specifies the height of the displayed (or printed) image. The default is to display it with the same height it would have if displayed on the screen.
Z—The z position. The value of z is of use only if the 3D transformation is in effect via the T3d keyword.
Discussion
TVSIZE lets you easily control the size of a displayed or printed PV‑WAVE image.
It is usually the case that the resolution of an output device, such as a laser printer, does not match the resolution of your computer screen. Because of this difference in resolution, you may notice that printed images look smaller than images that appear on your screen. TVSIZE detects these differences in display resolution and automatically adjusts the size of the image, if necessary.
By default, a screen resolution of 100 dots per inch (dpi) is assumed for your system. (If you wish, you can specify your screen resolution precisely using the Screen_Dpi keyword.) The screen dpi is compared to the value of the system variables !D.X_Px_Cm and !D.Y_Px_Cm. (These system variables hold the (x, y) resolution in number of pixels per centimeter for the currently active output device.) If there is a difference of greater than 20% between the screen resolution and the output device resolution, TVSIZE resizes the image accordingly. If the output device does not have scalable pixels, the CONGRID routine is used to expand the number of pixels to match the given size. If the device supports scalable pixels it simply receives the requested image size.
If you have annotated an image with text or lines or other graphics objects, you may notice that the printed output does not appear the way it appears on your screen. Specifically, the annotations may appear to be moved away from the image. If this is the case, use the Resize_Device keyword. This keyword explicitly resizes the output device to match the image size, resulting in output that closely matches the graphics as they appear on your screen.
TVSIZE assumes that your screen resolution is 100 dots per inch (dpi). To improve the ability of TVSIZE to estimate the size of the image on the screen and correctly size the image for printing, do the following:
1. At a point in the application where the screen device is active save the screen resolution (in dpi):
scr_dpi = [!D.X_Px_Cm,!D.Y_Px_Cm]*2.54
2. When displaying the image, use the command:
TVSIZE, image, x, y, Screen_Dpi=scr_dpi
Since the values of system variables !D.X_Px_Cm and !D.Y_Px_Cm change to match the current device, do not use them in the TVSIZE command.
note | System variables !D.X_Px_Cm and !D.Y_Px_Cm may not exactly reflect the resolution of the screen. These values are reported to PV‑WAVE and cannot be verified. |
Examples
To print an image at the same physical size displayed:
; Read the demo image.
mandril = BYTARR(512,512)
OPENR, unit, !Data_dir + 'mandril.img', /Get_lun
READU, unit, mandril
FREE_LUN, unit
TVSIZE, mandril, 0, 0
To print the image at position (50, 50) and to make the image 3 inches wide and 4 inches tall:
TVSIZE, mandril, 50, 50, XSize=3, YSize=4, /Inches
See Also