Scaling

<< Click to Display Table of Contents >>

Navigation:  Programming Techniques > Pictures >

Scaling

Previous pageReturn to chapter overviewNext page

As explained above, you are able to let VPE compute the x2 and y2 coordinates of an image by setting both to VFREE.

Picture(1, 1, VFREE, VFREE, "image1.tif")

 

You can also set only one of both coordinates to VFREE. Depending on the property PictureKeepAspect, VPE is able to compute this coordinate so that the image is not distorted (PictureKeepAspect = True) or VPE will use the original size of the image (PictureKeepAspect = False).

PictureKeepAspect = True (this property is by default True)

Picture(1, 1, -5, VFREE, "image1.tif")

In this example, the width of the image will be 5cm. If the image had an original size of 15 x 21 cm, the width is now 1/3 of the original size. Because PictureKeepAspect is True, VPE will compute the height to the same aspect ratio = 1/3 of the original height, which would then be 7 cm. (This example assumes that the image's resolution is the same for the width and the height. Otherwise the computations performed by VPE are slightly more difficult.)

 

Another option is, to let VPE compute the largest possible image size within a given rectangle without distorting the image. This is done by setting the property PictureBestFit = true.

PictureBestFit = true

Picture(1, 1, -10, -10, "image1.tif")

In the example, the given rectangle is 10 x 10 cm wide. VPE uses the largest dimension as a reference to compute the other dimension. If the image had an original size of 15 x 21 cm, VPE would use the image height (21 cm) as the reference to compute the largest possible width. (If the image was 21 x 15 cm, VPE would use the width as the reference to compute the best fitting height). The height is now scaled to 10cm (the height of the given rectangle) which is a scaling factor of 10 cm / 21 cm = about 0.476. The width is then scaled with the same factor: 15 * 0.476 = about 7.14 cm. (This example assumes that the image's resolution is the same for the width and the height. Otherwise the computations performed by VPE are slightly more difficult.)

 

NOTE: The use of the property PictureBestFit requires that all coordinates of the rectangle are specified. You can not use VFREE.

 

You can scale an image also to absolute coordinates regardless of its original metric size.

Picture(1, 1, 15, 20, "image1.tif")

 

NOTE: In addition to the above ways of scaling images, there is also the option to render the size of an image without inserting it into a document (see “Rendering Objects”).