ImageGetIPTCMetadata
Returns the IPTC metadata from an image. This BIF allows you to extract professional image metadata in BoxLang, such as copyright, author, headline, and more.
Syntax
ImageGetIPTCMetadata(name)Arguments
name
any
Yes
The image or the name of a variable referencing an image, or a file path to an image.
Returns
IStruct: A struct containing the IPTC metadata from the image.
Description
ImageGetIPTCMetadata extracts IPTC (International Press Telecommunications Council) metadata from the specified image. You can pass a BoxImage object, a variable name referencing an image, or a file path string.
IPTC metadata is commonly used by photographers, photo agencies, and news organizations to embed descriptive information in images. The returned struct contains key-value pairs for available IPTC fields.
Common IPTC fields include:
Copyright- Copyright noticeCaptionorCaption-Abstract- Image descriptionHeadline- Brief title or headlineKeywords- Array or list of keywordsBy-lineorAuthor- Photographer/creator nameCredit- Provider/agency creditSource- Original ownerDate Created- Creation dateCity,Province-State,Country-Primary Location Name- Location informationCategory- Subject categorySupplemental Category- Additional categories
Example
// Get IPTC metadata from a BoxImage
meta = ImageGetIPTCMetadata(myImage);
if (structKeyExists(meta, "Copyright")) {
writeOutput("© #meta.Copyright#<br>");
}
if (structKeyExists(meta, "Keywords")) {
writeOutput("Tags: #arrayToList(meta.Keywords)#<br>");
}
// Get IPTC metadata directly from a file
meta = ImageGetIPTCMetadata("/path/to/photo.jpg");
writeOutput("Caption: #meta["Caption-Abstract"]#");See Also
ImageGetExifMetaData
ImageGetBlob
Notes
The image can be passed as a BoxImage object, a variable name referencing an image, or a file path string.
If the image cannot be read or metadata cannot be processed, an error is thrown.
The returned struct contains only available IPTC fields for the image.
Not all images contain IPTC metadata - check for key existence before accessing.
IPTC data is primarily found in JPEG files from professional photography workflows.
Field names may vary slightly - use
structKeyList()to see available keys.For individual tag values, use
ImageGetIPTCTaginstead.
Last updated
Was this helpful?
