Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

XMP namespaces and properties. Where to find a list of these therms?

Advocate ,
Jan 01, 2013 Jan 01, 2013

Hi

I´m trying to create a script that stores some xmp informations of photos (like EXIF Data Created...IPTC Core Creator and so on) to variables.

var selected = app.document.selections

var xmp = selected[0].metadata

var creationData = xmp.read (namespace, property)

var author = xmp.read (namespace, property)

In order to do it I need to know the right namespace and property. The Bridge JavaScript reference does not show me a list of what I can use. Do you have any reference to follow?

I´m having no sucess looking over internet. Thank you a lot (again) for the help

Best Regards

Gustavo.

TOPICS
Scripting
3.2K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Guru , Jan 01, 2013 Jan 01, 2013

IMO the easiest way is to just select a file in bridge and get info… comm+i and look at the raw data…

Translate
Guru ,
Jan 01, 2013 Jan 01, 2013

IMO the easiest way is to just select a file in bridge and get info… comm+i and look at the raw data…

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Jan 01, 2013 Jan 01, 2013

Hi Muppet

Yes...its the easy way...but I need to store these names in variables as strings in my scripts because I intent to use these datas to rename files and also folders automatically.

How could I find a list of namespaces and properties to use along the method metadata.read()??

Thank you a lot

Best Regards

Gustavo

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Jan 01, 2013 Jan 01, 2013

Hum...interesting Muppet

Now I understand your answer!! haha

I´ll try this and tell you if sucess

Thank you a lot

Best Regards

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Jan 01, 2013 Jan 01, 2013

Perfect, Muppet

That´s perfect for raw data (capturing exif)..

How about fields in the IPTC section? How could I reach it??? (like Creator, Keywords, Instructions)....these fields can be edited so I assume I can even write in add to only read.

I´m trying such:

var author = xmp.read("http://www.iptc.org/photometadata/", "Creator")

but it´s not accepting.

Thank you a lot

Gustavo.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Jan 01, 2013 Jan 01, 2013

Oops...found also in Raw data too

var author = xmp.read("http://purl.org/dc/elements/1.1/", "dc:creator")

No questions any longer!

Thank you

Gustavo.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Jan 01, 2013 Jan 01, 2013
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Jan 01, 2013 Jan 01, 2013

Thank you a lot Michael. This document is also very useful. Thank you for sharing.

just one more question. In Bridge JavaScript reference I'm not finding a method for writting values to a specific metadata field. For example I have a name stored to a variable and would like to set it as Creator (IPTC) for the selected image.

The metadata.read allow me to see the values. But how to write in the fields? Like a Document.info property in Photoshop?

Thank you very much

Best regards

Gustavo

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Jan 02, 2013 Jan 02, 2013

To do this requires you loading the external XMP library object… You will find this covered in section 10 of the JavaScript Tools Guide ( this is the guide for the non-app specific stuff ). There are also lots of Paul's examples here too…

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Jan 02, 2013 Jan 02, 2013

Thank you Muppet

I´m reading that JavaScript reference (at true I´m reading a lot of references..my head is spinning hahaha)...and also saw some Paul´s examples here in the forum

Look at my code (I´m trying to insert my name in the IPTC Core Ceator field). But it does not work. What Am I missing?

var selections = app.document.selections

if (ExternalObject.AdobeXMPScript==undefined){

    ExternalObject.AdobeXMPScript = new ExternalObject("lib:AdobeXMPScript")

}

var xFile = new XMPFile (selections[0].spec.fsName, XMPConst.UNKNOWN, XMPConst.OPEN_FOR_UPDATE)

var xmp = xFile.getXMP()

xmp.deleteProperty (XMPConst.NS_IPTC_CORE, "Creator")

xmp.setProperty (XMPConst.NS_IPTC_CORE, "Creator", "Gustavo")

if (xFile.canPutXMP(xmp)){

    xFile.putXMP(xmp)

    xFile.closeFile(XMPConst.CLOSE_UPDATE_SAFETY)

}

Thank you a lot for the help

Best Regards

Gustavo.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Jan 03, 2013 Jan 03, 2013

That field is an Array  also Creator should be creator, so it would be ...

var selections = app.document.selections;
if (ExternalObject.AdobeXMPScript==undefined) ExternalObject.AdobeXMPScript = new ExternalObject("lib:AdobeXMPScript");

var xFile = new XMPFile (selections[0].spec.fsName, XMPConst.UNKNOWN, XMPConst.OPEN_FOR_UPDATE);
var xmp = xFile.getXMP();
xmp.deleteProperty (XMPConst.NS_IPTC_CORE, "creator");
xmp.appendArrayItem(XMPConst.NS_DC, "creator", "Gustavo", 0, XMPConst.ARRAY_IS_ORDERED);

if (xFile.canPutXMP(xmp)){
    xFile.putXMP(xmp);
    xFile.closeFile(XMPConst.CLOSE_UPDATE_SAFETY);
}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Jan 03, 2013 Jan 03, 2013

Hi Paul

It´s not working yet. Althought it does not get erros...after running the field creator (IPTC) keeps empty.

I made some changes to accomodate all selected thumbnails..made some alternatives but did not have sucess..

Look:

var selected = app.document.selections

var person = prompt("Tell the name of the person", "")

for (var a in selecionados){

    var xFile = new XMPFile (selected.spec.fsName, XMPConst.FILE_JPEG, XMPConst.OPEN_FOR_UPDATE);

    var xmp = xFile.getXMP();

    xmp.deleteProperty (XMPConst.NS_IPTC_CORE, "creator");

    xmp.appendArrayItem(XMPConst.NS_IPTC_CORE, "creator", person, 0, XMPConst.ARRAY_IS_ORDERED);

    if (xFile.canPutXMP(xmp)){

        xFile.putXMP(xmp);

        xFile.closeFile(XMPConst.CLOSE_UPDATE_SAFETY);

    }

}


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Jan 03, 2013 Jan 03, 2013

Does this help...

var selected = app.document.selections

var person = prompt("Tell the name of the person", "")

if (ExternalObject.AdobeXMPScript==undefined) ExternalObject.AdobeXMPScript = new ExternalObject("lib:AdobeXMPScript");

for (var a  in selected){

var xFile = new XMPFile (selected.spec.fsName, XMPConst.UNKNOWN, XMPConst.OPEN_FOR_UPDATE);

var xmp = xFile.getXMP();

xmp.deleteProperty (XMPConst.NS_DC, "creator");

xmp.appendArrayItem(XMPConst.NS_DC, "creator", person, 0, XMPConst.ARRAY_IS_ORDERED);

    if (xFile.canPutXMP(xmp)){

        xFile.putXMP(xmp);

        xFile.closeFile(XMPConst.CLOSE_UPDATE_SAFETY);

    }

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Jan 03, 2013 Jan 03, 2013

Hey Paul

Now it worked!! Thank you a lot

Comparing the 2 what I see is just a change from NS_IPTC_CORE to NS_DC when deletting and appending the property??? (of couse, there is also the load of the external XMP Script but it I was doing in my original script).

Why did you made this change? Just to better understand the idea!

Thank you a lot and best regards

Gustavo.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Jan 03, 2013 Jan 03, 2013

It was my fault I got it wrong the first time Gustavo

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Jan 03, 2013 Jan 03, 2013
LATEST

Haha, no no, Paul

The NS_IPTC_CORE was written by me in my first approach (the one I posted here). And you corrected it using NS_DC. And I do not understand why IPTC_CORE was wrong hahahah. Would like to understand why NS_DC worked and IPTC_CORE did not work since the creator field is part of the core haha

Best Regards

Gustavo.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines