Topics   All   Mac OS X (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server   Client   Old   Guides   Examples
New in version: 8.5   9.0   9.1   9.2   9.3   9.4   9.5   10.0   10.1   10.2    Statistic  

GMImage.GetAttribute

Query a named attribute.

Component Version macOS Windows Server FileMaker Cloud FileMaker iOS SDK
GraphicsMagick 2.0 Yes Yes Yes Yes Yes
MBS( "GMImage.GetAttribute"; ImageRef; name { ; Encoding } )   More

Parameters

Parameter Description Example value
ImageRef The image reference number. 1
name The name of the attribute.
Encoding Optional
The text encoding.
Default is UTF-8.
Possible encoding names: ANSI, Arabic-Mac, Arabic-Win, Baltic-Win, CentralEurope-Mac, ChineseSimp-Mac, ChineseSimp-Win, ChineseTrad-Mac, ChineseTrad-Win, Cyrillic-Mac, Cyrillic-Win, EasternEurope-Win, Greek-Mac, Greek-Win, Hebrew-Mac, Hebrew-Win, ISO-8859-1, ISO-8859-2, ISO-8859-3, ISO-8859-4, ISO-8859-5, ISO-8859-6, ISO-8859-7, ISO-8859-8, ISO-8859-9, ISO-8859-15, Korean-Johab, Korean-Mac, Korean-Win, Latin1, Mac, Native, ShiftJIS-Mac, ShiftJIS-Win, Turkish-Mac, Turkish-Win, UTF-8, DOS or Windows. Pass native to use the native encoding of the current platform.
UTF8

Result

Returns the value as string.

Description

Query a named attribute.
Any number of named attributes may be attached to the image. For example, the image comment is a named image attribute with the name "comment". EXIF tags are attached to the image as named attributes. Use the syntax "EXIF:<tag>" to request an EXIF tag similar to "EXIF:DateTime":

Examples

Read EXIF DateTime:

MBS( "GMImage.GetAttribute"; $image; "EXIF:DateTime" )

Query IPTC Keywords:

MBS("GMImage.GetAttribute"; $img; "IPTC:2:25"; "UTF-8")

Query JPEG Quality used to compress image:

Set Variable [$img; Value:MBS("GMImage.NewFromContainer"; Image::InputImage)]
Set Variable [$value; Value:MBS("GMImage.GetAttribute"; $img; "JPEG-Quality")]
Show Custom Dialog ["JPEG Quality used to compress image"; $value]
Set Variable [$r; Value:MBS("GMImage.Release"; $img)]

Read PNG original color type:

MBS("GMImage.GetAttribute"; $image; "png:IHDR.color-type-orig")
// Value is combination of 0 = gray, 1 = palette, 2 = color, 4 = alpha
// e.g. 4 = Gray + Alpha, 6 = RGBA, 2 = RGB, 0 = Gray

Query JPEG Colorspace:

MBS("GMImage.GetAttribute"; $img; "JPEG-Colorspace-Name") & " " & MBS("GMImage.GetAttribute"; $img; "JPEG-Colorspace")
// the numbers are: 1 = grayscale, 2 = RGB, 3 = YCbCr, 4 = CMYK, 5 = YCCK

Show GPS location:

Set Variable [ $img ; Value: MBS("GMImage.NewFromContainer"; GraphicsMagick Exif::InputImage) ]
Set Variable [ $lat ; Value: MBS("GMImage.GetAttribute"; $img; "EXIF:GPSLatitude") ]
Set Variable [ $long ; Value: MBS("GMImage.GetAttribute"; $img; "EXIF:GPSLongitude") ]
Show Custom Dialog [ "GPS" ; $lat & " / " & $long ]
Set Variable [ $r ; Value: MBS("GMImage.Release"; $img) ]

See also

Example Databases

Blog Entries

Created 18th August 2014, last changed 10th June 2019


GMImage.GetAntiAlias   -   GMImage.GetAttributeNames

Feedback: Report problem or ask question.




Links
MBS Xojo Chart Plugins