Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

CGImageSource.Property

Queries the value of a property.

Component Version macOS Windows Linux Server iOS SDK
CGImageSource 3.4 ✅ Yes ❌ No ❌ No ✅ Yes, on macOS ✅ Yes
MBS( "CGImageSource.Property"; Ref; Index; Key )   More

Parameters

Parameter Description Example
Ref The image source reference number returned by CGImageSource.CreateWithData, CGImageSource.CreateWithPath or CGImageSource.CreateWithURL $ref
Index The index of the image to query. -1 for global properties. Else a number from 0 to CGImageSource.Count-1. 0
Key The property name to query. "PixelWidth"

Result

Returns the value or error message.

Description

Queries the value of a property.
See CGImageSource.Keys for a list of available properties.

Keys include (list not complete):

FileSize, {Exif}.ExposureTime, {Exif}.SubjectDistRange, {Exif}.MaxApertureValue, {Exif}.Flash, {Exif}.ColorSpace, {Exif}.ExifVersion, {Exif}.FocalLenIn35mmFilm, {Exif}.SceneCaptureType, {Exif}.ShutterSpeedValue, {Exif}.FNumber, {Exif}.LightSource, {Exif}.FileSource, {Exif}.Saturation, {Exif}.PixelYDimension, {Exif}.Sharpness, {Exif}.ApertureValue, {Exif}.Contrast, {Exif}.PixelXDimension, {Exif}.CustomRendered, {Exif}.WhiteBalance, {Exif}.DateTimeDigitized, {Exif}.ExposureProgram, {Exif}.ISOSpeedRatings, {Exif}.DateTimeOriginal, {Exif}.MeteringMode, {Exif}.FlashPixVersion, {Exif}.ComponentsConfiguration, {Exif}.ExposureMode, {Exif}.DigitalZoomRatio, {Exif}.ExposureBiasValue, ColorModel, Orientation, DPIHeight, PixelWidth, {IPTC}.Caption/Abstract, {IPTC}.TimeCreated, {IPTC}.DateCreated, {IPTC}.DigitalCreationDate, {IPTC}.DigitalCreationTime, PixelHeight, ProfileName, Depth, {TIFF}.Model, {TIFF}.ResolutionUnit, {TIFF}.YResolution, {TIFF}.XResolution, {TIFF}.Orientation, {TIFF}.ImageDescription, {TIFF}.Software, {TIFF}.DateTime, {TIFF}.Make, {JFIF}.DensityUnit, {JFIF}.IsProgressive, {JFIF}.YDensity, {JFIF}.JFIFVersion, {JFIF}.XDensity, DPIWidth.

Version 10.0 and newer may return arrays and dictionaries as JSON.

Examples

Query Image dimensions in pixel :

MBS( "CGImageSource.Property"; $ref; 0; "PixelWidth") & " x " & MBS( "CGImageSource.Property"; $ref; 0; "PixelHeight")

Query Image resolution in dpi:

MBS( "CGImageSource.Property"; $ref; 0; "DPIWidth") & " x " & MBS( "CGImageSource.Property"; $ref; 0; "DPIHeight")

Query GPS of first image:

Set Variable [ $img ; Value: MBS("CGImageSource.CreateWithData"; CGImageSource::ImageFile) ]
Set Variable [ $lat ; Value: MBS("CGImageSource.Property"; $img; 0; "{GPS}.Latitude") ]
Set Variable [ $long ; Value: MBS("CGImageSource.Property"; $img; 0; "{GPS}.Longitude") ]
Show Custom Dialog [ "GPS" ; $lat & " / " & $long ]
Set Variable [ $r ; Value: MBS("CGImageSource.Release"; $img) ]

See also

Release notes

Example Databases

Blog Entries

This function checks for a license.

Created 18th August 2014, last changed 10th January 2020


CGImageSource.Properties - CGImageSource.Release