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

Edit IPTC metada in illustrator extendscript

Explorer ,
Feb 03, 2018 Feb 03, 2018

Copy link to clipboard

Copied

Hi guys,

I'm batch editing all jpeg files metadata. I achieve to edit XMP title,description, keyword of jpeg files. But I want to edit IPTC data of these jpeg files too. Because shutterstock reads metadata from IPTC. So is it possible to edit IPTC description, keyword with extendscript in Illustrator ? if possible how ?

I attached sample jpeg IPTC below. Just I want to copy XMP metadata to suitable IPTC metada.

Any help appreciated ! Thanks !

Screen Shot 2018-02-03 at 9.05.22 PM.png

TOPICS
Scripting

Views

1.5K

Translate

Translate

Report

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
Adobe
Valorous Hero ,
Feb 04, 2018 Feb 04, 2018

Copy link to clipboard

Copied

Here's a function which I dug up from a long time ago which reads only the description string:

function ReadXMPviaLibrary(targetFile){

  if(ExternalObject.AdobeXMPScript == undefined) {

      ExternalObject.AdobeXMPScript = new ExternalObject('lib:AdobeXMPScript');

  }

  var fNm = targetFile, obj;

  var xmp = new XMPFile( fNm.fsName, XMPConst.UNKNOWN, XMPConst.OPEN_FOR_READ);

  obj = xmp.getXMP();

  xmp.closeFile();

  var descriptionString = "";

  try{

    descriptionString = obj.getLocalizedText(XMPConst.NS_DC, "description", null, "en");

    return descriptionString;

  } catch(e){

    return null;

  }

};

Ten_A is the local master of all things XMP:

Re: Script to copy variables into metadata

And here's one where Ten_A also adds more code regarding this topic:

Re: Adobe Illustrator Tags

Hopefully you can edit the functions to accomplishyour goal!

Votes

Translate

Translate

Report

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
Community Expert ,
Feb 04, 2018 Feb 04, 2018

Copy link to clipboard

Copied

You can add below method after getXMP() in Silly-V's code. You'll see some IPTC info in ESTK console.

$.write(obj.dumpObject());

Votes

Translate

Translate

Report

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
Explorer ,
Feb 05, 2018 Feb 05, 2018

Copy link to clipboard

Copied

Silly-V​ @Ten A,  thank you for your responses. These are so helpful.

But I want to edit IPTC info with ExtendScript. Because shutterstock reads IPTC data, not XMP data. I want to copy XMP to IPTC and save it.

Votes

Translate

Translate

Report

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 ,
Feb 05, 2018 Feb 05, 2018

Copy link to clipboard

Copied

As far as I know, It is all inside XMP data. I am wondering if shutterstock is simply reading the IPTC fields inside the XMP data?

Votes

Translate

Translate

Report

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
Community Expert ,
Feb 05, 2018 Feb 05, 2018

Copy link to clipboard

Copied

Here is a sample dump of metadata.

Dumping XMPMeta object ""  (0x0)

  dc:  http://purl.org/dc/elements/1.1/  (0x80000000 : schema)

      dc:format = "application/pdf"

      dc:title  (0x1E00 : isLangAlt isAlt isOrdered isArray)

        [1] = "iptcTest"  (0x50 : hasLang hasQual)

              ? xml:lang = "x-default"  (0x20 : isQual)

      dc:creator  (0x600 : isOrdered isArray)

        [1] = "ten"

  xmp:  http://ns.adobe.com/xap/1.0/  (0x80000000 : schema)

      xmp:MetadataDate = "2018-02-05T08:37:32+09:00"

      xmp:ModifyDate = "2018-02-05T08:37:32+09:00"

      xmp:CreateDate = "2018-02-05T08:37:32+09:00"

      xmp:CreatorTool = "Adobe Illustrator CC 2017 (Macintosh)"

      xmp:Thumbnails  (0xE00 : isAlt isOrdered isArray)

        [1]  (0x100 : isStruct)

            xmpGImg:width = "256"

            xmpGImg:height = "256"

            xmpGImg:format = "JPEG"

            xmpGImg:image = "/9j/4AAQSkZJRgABAgEASABIAAD/7QAsUGhvdG9zaG9wIDMuMAA4QklNA+0AAAAAABAASAAAAAEA

AQBIAAAAAQAB/+4ADkFkb2JlAGTAAAAAAf/bAIQABgQEBAUEBgUFBgkGBQYJCwgGBggLDAoKCwoK

......

                  xmpG:swatchName = "C=60 M=90 Y=0 K=0"

                  xmpG:mode = "CMYK"

                  xmpG:type = "PROCESS"

                  xmpG:cyan = "60.000000"

                  xmpG:magenta = "90.000000"

                  xmpG:yellow = "0.003100"

                  xmpG:black = "0.003100"

  pdf:  http://ns.adobe.com/pdf/1.3/  (0x80000000 : schema)

      pdf:Producer = "Adobe PDF library 15.00"

  Iptc4xmpCore:  http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/  (0x80000000 : schema)

      Iptc4xmpCore:CreatorContactInfo  (0x100 : isStruct)

        Iptc4xmpCore:CiAdrExtadr = "Wakayama, Japan"

"http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/ " is namespace of the IPTC meta, We need to use when we access the IPTC metadata.

Votes

Translate

Translate

Report

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 ,
Feb 05, 2018 Feb 05, 2018

Copy link to clipboard

Copied

LATEST

I used dumpObject just now to get a sense of the way color plate names are recorded inside this data.

Fortunately, it really helped, and extra googling yielded the correct XMPConst enumeration to read this information too:


And now I have a function which gets a file's plates just like this!

function getPlateNamesFromXMP(targetFile){

  if(ExternalObject.AdobeXMPScript == undefined) {

    ExternalObject.AdobeXMPScript = new ExternalObject('lib:AdobeXMPScript');

  }

  var fNm = targetFile, obj;

  var xmp = new XMPFile( fNm.fsName, XMPConst.UNKNOWN, XMPConst.OPEN_FOR_READ);

  obj = xmp.getXMP();

  xmp.closeFile();

  var metaString = "";

  try{

  var plateNames = [];

    var plateNameAmt = obj.countArrayItems(XMPConst.TYPE_PAGEDFILE, "PlateNames");

    for (var i = 0; i < plateNameAmt; i++) {

    plateNames.push(obj.getArrayItem(XMPConst.TYPE_PAGEDFILE, "PlateNames", (i + 1)));

    }

    return plateNames;

  } catch(e){

    return null;

  }

};

Votes

Translate

Translate

Report

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