要在Bridge / Photoshop中使用Adobe javascript访问IPTC扩展数据吗?

时间:2019-01-29 15:25:54

标签: javascript adobe xmp iptc adobe-bridge

我可以很好地获取XMP / IPTC CORE数据,但似乎无法获取Iptc4xmpExt数据。这是艺术品或物品的详细信息。

// load the xmp library
if ( ExternalObject.AdobeXMPScript == undefined ) {
    ExternalObject.AdobeXMPScript = new ExternalObject( "lib:AdobeXMPScript");
}

//must call next line to ensure you are working with the most up to date data
app.synchronousMode = true;

//if a thumbnail is selected
if (app.document.selectionLength > 0){

    // Get the first selected thumbnail
    thumb = app.document.selections[0];

    //get the xmp data and serialize (convert to xml string )
    xmp = new XMPMeta( thumb.metadata.serialize() );

    //get a simple xmp property
    var xmpTitle = "Title: " + xmp.getLocalizedText(XMPConst.NS_DC, "title", null, "en");
    var xmpHeadline= "Headline: " + xmp.getProperty(XMPConst.NS_PHOTOSHOP, "Headline");
    var xmpAODate = "Art Object Date: " + xmp.getArrayItem( ??? **WhAT TO PUT HERE** ???);


    alert(xmpTitle + '\n' +xmpHeadline + '\n' +xmpAODate);
}//end If selected

特别是我需要'AODateCreated'。但我似乎无法弄清楚要使用哪个名称空间

我尝试过:

xmp.getProperty(XMPConst.NS_IPTC_CORE,"Iptc4xmpExt:AODateCreated");
xmp.getProperty(XMPConst.NS_PHOTOSHOP,"Iptc4xmpExt:AODateCreated");
xmp.getArrayItem(XMPConst.NS_IPTC_CORE, "Iptc4xmpCore:ArtworkOrObject",1);

但是运气不好,因为我显然没有掌握我在这里需要做的事情。我相信它是一个无序的数组,但是我也无法使其正常工作。

我知道数据在字段中,因为我可以使用ExifTool命令查看数据:

exiftool -X -XMP-iptcExt:ArtWorkDateCreated 001.jpg

Here is the best test image from IPTC.org

任何帮助将不胜感激! 谢谢

0 个答案:

没有答案