Tech Tip: Retrieving the properties of a picture stored on a hard disk
PRODUCT: ACI Pack | VERSION: 6.0 | PLATFORM: Mac & Win
Published On: February 11, 2000
You can retrieve the dimensions (in pixels) of a picture stored on your hard disk by combining the use of the two following commands:
- AP Read picture file (file;image)
This 4D_Pack command allows you to store a picture file in a picture variable. On Mac OS, it can open the following formats: JPEG, PICT, BMP and GIF. On Windows, the following formats are supported: WMF, EMF, Mac OS PICT, JPEG, BMP and GIF. - PICTURE PROPERTIES (picture; width; height{; hOffset{; vOffset{; mode}}})
This 4D command returns the properties of the picture passed in the "picture" parameter.
The following code displays an open-file dialog and stores the dimensions of the picture the user selects in the Width and Height variables.
This code works with both version 6.0.x and 6.5.x of 4D.
Cut and Paste the following code example into your own 4D project
myDocRef:=Open document("")
CLOSE DOCUMENT(myDocRef)
$err:=AP Read picture file (document;MyPict)
PICTURE PROPERTIES(MyPict;Width;Height)