EDOBE XDOM TAKE 6 IR - PRODUCTSHEET Especificações Página 258

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
  • Página
    / 304
  • Índice
  • MARCADORES
  • Avaliado. / 5. Com base em avaliações de clientes
Vista de página 257
CHAPTER 10: Scripting Access to XMP Metadata Accessing the XMP scripting API 258
Using the XMP scripting API
The XMPMeta object is the primary means of access to the namespaces and properties of an XMP
metadata packet. Through this object, you can create and delete namespaces and properties, and
examine and modify property values.
You can obtain or create an XMPMeta object
in several ways:
X You can use an XMPFile object to retrieve existing metadata directly from a file. The
XMPFile.getXMP() method creates an XMPMeta object, which you can use to examine or modify the
properties and their values. You can then use
XMPFile.putXMP() to write the modified metadata back
to the file.
X You can create an XMPMeta object with the constructor, initializing it with an XMP packet created or
obtained elsewhere.
X You can create a new, empty XMPMeta object with the constructor, and use its methods to create
entirely new namespaces and properties. You can then use
XMPFile.putXMP() to inject the new
metadata into a file.
In Adobe Bridge, you can pass XMP metadata between the built-in
Metadata object and the XMPScript
XMPMeta object
using serialized XMP.
X You can use XMPScript to examine thumbnail metadata by creating the XMPMeta object from the
metadata stored with a
Thumbnail object, using the object constructor. To ensure that the metadata is
up-to-date, use synchronous mode (which is off by default):
var thumb = new Thumbnail(new File("/C/myImage.jpg"));
app.synchronousMode = true;
xmp = new XMPMeta(thumb.metadata.serialize());
or
xmp = new XMPMeta(thumb.synchronousMetadata.serialize());
X
You can modify the metadata in an Adobe Bridge thumbnail by creating a new Metadata object with
serialized XMP. Continuing the previous example:
// create a compact XMP packet
newPacket = xmp.serialize(XMPConst.SERIALIZE_OMIT_PACKET_WRAPPER |
XMPConst.SERIALIZE_USE_COMPACT_FORMAT));
thumb.metadata = new Metadata(newPacket);
X
To write metadata back to the file for a thumbnail, you can access the thumbnails file and create an
XMPFile object
object to access the embedded metadata directly.
xmp = new XMPFile(thumb.spec.fsName, XMPConst.UNKNOWN,
XMPConst.OPEN_FOR_UPDATE);
NOTE: The XMPFile object does not support all of the file formats that Adobe Bridge supports.
Creating new metadata
This code creates an empty XMPMeta object
, uses it to set a metadata property, and serializes it to a string,
which you could pass to an authoring tool, for example, or store in a file.
xmp = new XMPMeta();
xmp.setProperty(XMPConst.NS_XMP, "CreatorTool", "My Script");
xmpStr = xmp.serialize(); // serialize the XMP packet to XML
Vista de página 257
1 2 ... 253 254 255 256 257 258 259 260 261 262 263 ... 303 304

Comentários a estes Manuais

Sem comentários