The GetFileDimensions function gets an information about image file and dimensions of the picture.
Specifies the name of the file to get info about.
You can specify the binary safearray instead of file name string. In this
case the necessary day will be get from that array. Using FileStart
and FileSize properties, you can set where the
image data are located in the array.
Other ShotGraph object can also be specified instead of file name. In this case the information about active imagespace
of that object will be returned.
Variable accepting horizontal size of the image in pixels
Variable accepting vertical size of the image in pixels
Optional. On return, contains two dimensional array with image palette,
if the image is a GIF image or paletted BMP image.
The first index of array is the color number. The second index of array (0..2) is
accordingly red, green, and blue color component. The lower bound of array
is always zero.
The possible return values are:
- <0 - error code, file could not be opened
- 0 - the image file is not recognized
- 1 - the image file is a GIF file
- 2 - the image file is a JPEG file
- 3 - the image file is a BMP file
- 4 - the image file is a WMF file (metafile image)
- 5 - the image file is a PNG file
- 6 - the image file is a TIFF file
- 1000 - the image is other ShotGraph object
- 1001 - the image is Picture object
This function analizes file content and returns both horizontal and
vertical sizes of the image. It can be used in your Web applications
which need to know image sizes before sending 'IMG SRC=... width=... height=...' tag
to the client.
The function checks whether the image file is a vector metafile image
only if the AdvancedCheck property is set
The GetFileDimensions sets the Resolution
property if image has been recognized as Jpeg, Png or Tiff. This feature allows to check
not only dimensions of images but their resolutions too.
Possible data types for 'sFileName' parameter
|String||Path to file. The image will be read from that file.|
|Safearray||Image in safearray. The image will be read from safearray.|
|ShotGraph object||The image will be read from active imagespace of other ShotGraph object.|
Select Case obj.GetFileDimensions(filename,x,y)
out_str="GIF image: " & x & "x" & y
out_str="JPEG image: " & x & "x" & y
out_str="BMP image: " & x & "x" & y
out_str="PNG image: " & x & "x" & y
out_str="Unknown file format"
<H2>Information about file <% =filename %></H2>
<% =out_str %>