Topics
All
MacOS
(Only)
Windows
(Only)
Linux
(Only, Not)
iOS
(Only, Not)
Components
Crossplatform Mac & Win
Server
Client
Old
Deprecated
Guides
Examples
Videos
New in version:
9.3
9.4
9.5
10.0
10.1
10.2
10.3
10.4
10.5
10.6
Statistic
FMM
Blog
GMImage.GetAttribute
Query a named attribute.
| Component | Version | macOS | Windows | Linux | Server | FileMaker iOS SDK |
| GraphicsMagick | 2.0 | Yes | Yes | Yes | Yes | Yes |
Parameters
| Parameter | Description | Example | Flags |
|---|---|---|---|
| ImageRef | The image reference number. | 1 | |
| name | The name of the attribute. | ||
| Encoding | The text encoding. Default is UTF-8. Possible encoding names: ANSI, ISO-8859-1, Latin1, Mac, Native, UTF-8, DOS, Hex, Base64 or Windows. More listed in the FAQ. |
UTF8 | Optional |
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":
Unicode characters are escaped with backslash followed by three digits. If encoding is UTF-8 for example the encoding \303\244 represents an "ä".
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
- GMImage.GetAttributeNames
- GMImage.GetAttributesJSON
- GMImage.New
- GMImage.NewFromContainer
- GMImage.Release
- GMImage.SetAttribute
Example Databases
Blog Entries
Release notes
- Version 9.2
- Added GMImage.GetAttributeNames and GMImage.GetAttributesJSON functions.
Created 18th August 2014, last changed 23th October 2020
GMImage.GetAntiAlias - GMImage.GetAttributeNames
Feedback: Report problem or ask question.
Links
MBS FileMaker Plugins