TrFile_SetMetaData |
Sets metadata into an image file. Metadata can contain a description of the image, copyright information, etc.
Syntax
TrFile_SetMetaData ( switches ; sourceFilePath ; destFilePath ;
metadatablock )
Parameters
switches | these determine the metadata that is set |
sourceFilePath | the path to the source file |
destFilePath | (optional) the path to the destination file |
metaDataBlock | text formatted for this function |
Switches
switches can be one or more of the following:
-SetIPTC | set the IPTC metadata (Photoshop’s File Info) |
-SetExif | set the Exif metadata |
-MacCharSet | the IPTC data will be written Mac encoded |
-WinCharSet | the IPTC data will be written Windows encoded |
-UTF8CharSet | the IPTC data will be written as UTF-8 encoded characters (new!) |
Returned Result
Data type returned
Error code
Result
The returned result is an error code. Returned error codes can be:
0 | no error | the metadata was set |
$$-43 | fnfErr | source file not found |
Other errors may be returned.
Originated in
Troi File Plug-in 3.5
Compatibility
FileMaker Pro 17 to FileMaker Pro 21 (2024)
Considerations
If the destination parameter is empty the metadata will be saved in the source file itself. This happens also when you specify the same source file and destination file.
Currently only works with JPEGs.
ISSUES: Photoshop (or other programs) may have added other types of metadata, like XMP. These types of metadata are not changed at the moment. This may cause inconsistent metadata in the file.
If you want to remove IPTC data set the metaDataBlock to “”
See the example files “IPTC_XMP_Metadata” for information on how to create the metadata block.
Example
Set Field [ gErrorCode ; TrFile_SetMetaData ( "-SetIPTC" ; "C:\myData\Photo1.jpg"; "" ;
"##IPTC 120¶ my caption ¶##END 120" ) ]
This will set the IPTC data, in this case only a caption. Note the returns in the IPTC data.
Example 2
Set Field [ gErrorCode ; TrFile_SetMetaData ( "-SetIPTC " & this::IPTC_DestinationCharSet ;
this::PathToSourceFile ; this::PathToDestinationFile ; this::gMetaDataBlock ) ]
gMetaDataBlock should contain something similar to this below:
##IPTC 120
FOR IMMEDIATE RELEASE–FILE–Shania Twain performs at the Country Music Association Awards show in Nashville, Tenn., …
##END 120
##IPTC 122
CJC RWP MAH
##END 122
##IPTC 105
SHANIA TWAIN
##END 105
##IPTC 40
FOR IMMEDIATE RELEASE. A SEPT. 22, 1999 FILE PHOTO. DIGITAL IMAGE
##END 40
…
Used in example files
IPTC_XMP_Metadata.fmp12
SetExif.fmp12
Related function
TrFile_GetMetaData |
Related script step
Set MetaData of Image File |
Related topics
Troi File Plug-in online help (overview)