Retrieving the default size of an imageΒΆ

ImageSize()

Retrieve the default size of an image


SYNTAX

ImageSize(window_id, pathname, width, height)

Return the default size of a bitmap, TIFF or jpeg image in the fields width and height.

window_id

The identifier of the window containing the image, or NULL if the image is to be drawn by the printer. Sculptor needs this information in order to tell which device unit would be used to draw the image.

pathname

The path of the image file, which must have a .bmp, .tif, .tiff, .jpg or .jpeg extension. The extension must be included in the pathname.

width
height

The default width and height of the image. The values returned are in the unit defined by sys.Unit. This defaults to device units, but may be set to centimetres or inches.


EXAMPLE

This example illustrates the use of the ImageSize() and DrawImage() functions in a report.

!temp Height,,r8
!temp Width,,r8
!temp Ratio,,r8
!temp Image,,a255

     sys.Unit = UNIT_INS
     Image = "C:/graphics/Logo.bmp"
     ImageSize(NULL, Image, Width, Height)
     Ratio = Width / Height

     if (Width > 8) {
          Ratio = Width / Height
          Width = 8
          Height = Width / Ratio
     }

     DrawImage(NULL, (8.0 - Width) / 2, 0, Width, Height, Image)

RELATED TOPICS

Drawing operations

Draw functions

DrawImage()

TextSize()