Shayton Equilibrium Kitchen Utensil 2003 User Manual

Page of 194
170 
 Appendix A 
• 
• 
• 
Low-Level Metadata Interface 
Two MediaScript objects provide support for metadata: The Media object and the 
_MR_Metadata object. 
The Media object provides support for loading and saving metadata along with the image 
contents. 
The _MR_Metadata object provides support for loading and merging just the metadata 
contained within the files, without loading the image data. This allows the scripter to 
modify the metadata within compressed files without decompressing and recompressing 
the image data. 
The Media Object 
The load command of the Media object will load and attach Exif, IPTC, and XMP metadata 
if the loadMetadata parameter to the load command is specified as true. For example: 
var image = new Media(); 
image.load(name @ “myimage.jpg”, loadMetadata @ true); 
This constructs an XML document for any Exif, IPTC, or XMP metadata contained in the 
file and attach it to the Media object. This metadata can be accessed by the scripter using 
the getMetadata command of the Media object. 
var metaDoc = image.getMetadata(“IPTC”); 
This metadata document can be processed and edited. To modify the metadata attached to 
the image, use the setMetadata method: 
image.setMetadata(“Exif”, myExifData);  
Finally, use the save method to save any metadata attached to the document unless the 
SaveMetadata
 parameter is set to false. 
image.save(type @ “jpeg”);  
The metadata names for use with the getMetadata and setMetadata methods are 
“Exif”, “IPTC”, and “XMP” for the Exif, IPTC, and XMP metadata documents, respectively. 
These names are case-sensitive. 
NOTE 
A save() function will embed a color profile for a color profile-supporting format without 
explicitly setting saveMetadata to “true” only when CMYK data is present.
The _MR_Metadata Object 
The _MR_Metadata object supports extracting metadata from supported file formats 
without loading the image data. It also supports merging new metadata into existing files 
without the need to interpret or decompress the image data. The _MR_Metadata object has 
two methods: save, and load. In addition, the _MR_Metadata object can be used as the 
MediaScript response object allowing the script to stream back a file with modified 
metadata.