TrFile_GetMetaData (function reference)

By May 1, 2017 May 15th, 2018 Online Help, Troi File Plug-in
Troi File Plug-in > Functions reference > TrFile_GetMetaData
Troi File Plug-in for FileMaker Pro


Gets metadata out of an image, movie or pdf. Metadata can be inserted by for example Photoshop, and can contain a description of the image, copyright information, etc.

SyntaxFunction badge

TrFile_GetMetaData ( switches ; filePath )


switchesthese determine the metadata that is returned
filePaththe path to the file


Switches can be one or more of the following:

-GetIPTCget the IPTC metadata (Photoshop’s File Info)
-GetXMPget XMP metadata (Adobe’s Extensible Metadata Platform )
-GetExifget the Exif metadata (a standard for digital cameras)
-GetRawExifget the Exif metadata (a standard for digital cameras), in a more original form
-GetGPSget the GPS (Global Positioning System) metadata, with the image coordinates
-GetJPEGCommentget the JPEG comment metadata of a JPEG file
-GetImageURLget the URL metadata (Photoshop’s File Info extension)
-GetImageDescriptionget a description like width, height and depth, resolution, codec name etc.

To specify the encoding you can use:

-SourceMacCharSetthe IPTC data has Mac encoded characters
-SourceWinCharSetthe IPTC data has Windows encoded characters
-SourceUTF8CharSetthe IPTC data will be read as UTF-8 encoded
-DontUseAutoUTF8Detectiondisable the automatic detection of UTF-8 encoding

For movies these switches can be used:

-GetMovieDescriptionget a description like width, height and depth, timecode, frames per second, codec name etc.
-GetMovieDurationget the duration in seconds of a movie
-GetTimecodeBeginget the begin Timecode of a movie
-GetTimecodeEndget the end Timecode of a movie
-GetTimecodeCurrentget the current Timecode of a movie
-GetMovieMetadataget all embedded metadata, for example Artist or Description
-GetMovieCreationDategets the creation date (incl. time + timezone) of the movie
-GetMovieGPSgets the GPS location data of the movie

With an extra -Format switch you can specify how the movie GPS location is returned:

-Format=Decimal(default) format the GPS using decimal coordinates
-Format=DegMinSecsformat the GPS using latitude, longitude (in degrees, minutes and seconds) and height (in meters)
-Format=ISO6709format the GPS using according to ISO 6709

If there is no Timecode track or GPS or creation data an empty string is returned.

For PDFs this switch can be used:

-GetPDFDescriptionget metadata of a PDF file, such as the document’s title, author, and creation date

Returned Result

Data type returned



the requested metadata, if available.

Returned error codes can be:

$$-2026userDataItemNotFoundthe requested metadata is not available

Originated in

Troi File Plug-in 2.0


FileMaker Pro 13 to 17


Prior to Troi File 9.0 this function was called TrFile_MetaData.

Starting with version 9.1: you can also use -GetXMP with movies that contain XMP. Version 9.1 also added the switches -GetMovieMetadata, -GetMovieCreationDate and -GetMovieGPS.

Note that some metadata is returned in a raw form. See the example files “IPTC_XMP_Metadata” and GetEXIF” for information on how to parse this.

Exif (Exchangeable image file) metadata in an image file will contain annotation data such as the time a photo was created, aperture and shutter speed. Your digital camera needs to have put this in the file.

From v6.0: When using the switch “-GetIPTC” the plug-in can now automatically detect if the text is UTF-8 encoded (and also returns with the metadata text correctly formatted). If UTF-8 format is detected it will override the switches: “-SourceMacCharSet” and “-SourceWinCharSet”.

IPTC data in image files can also be either Mac or Windows encoded . With the switches “-SourceMacCharSet” and “-SourceWinCharSet” you can manually tell the plug-in which character encoding you expect in the image files. Alternatively you can retrieve both encodings and then see which is best. Note: If you don’t specify a CharSet switch, the plug-in uses the encoding of the platform it is running on.

Version 5.5 added getting Exif from RAW files. v4.5 added the -GetRawExif switch: this will return the Exif data in a more original form, as fractions. For example aperture will be returned as 95/32, instead of 2.96875. This makes it possible to write Exif data back in the original form, with the TrFile_SetMetaData function.


Set Field [ result ; TrFile_GetMetaData ( "-GetExif " ; "C:\myData\Photo1.jpg" ) ]

This will return the raw EXIF data. The data will look like this:

##EXIF 270
##END 270
##EXIF 306
2011:06:09 10:50:40
##END 306

Example 2

Set Field [ result ; TrFile_GetMetaData ( "-GetIPTC " ;  gFilePath ) ]

This will return the raw IPTC data. The data will look like this:

##IPTC 120
FOR IMMEDIATE RELEASE–FILE–Shania Twain performs at the Country Music Association Awards show in Nashville, Tenn., …
##END 120
##IPTC 122
##END 122
##IPTC 105
##END 105
##IPTC 40
##END 40

Related functionsFunction badge


Related topics

Troi File Plug-in online help (overview)

Online Help Page for Troi File Plug-in for 13 to 17 –> TrFile_GetMetaData (filep4260) 2018-0515 16:12:33