Skip to main content
pixxxelschubser
Community Expert
Community Expert
November 24, 2016
Answered

[JS] How can I extract (or read) the credit and the source value from Metadata

  • November 24, 2016
  • 1 reply
  • 1207 views

Hi,

can someone help me please:

How can I extract (or read) the "Credit" and the "Source" value from Metadata in Bridge CC2015+ for all possible image file formats with Javascript?

(At the best without exiftool)

Any help would be greatly appreciated.

This topic has been closed for replies.
Correct answer SuperMerlin

Example to be run from Extendscript Toolkit.

#target bridge;

var thumbs = app.document.visibleThumbnails;

//file types to process

thumbs = app.document.getSelection("jpg,tif,gif,eps,psd,pcx,png,eps,crw,cr2,tiff,raw,rw2,dng,nef,orf,erf,mos,dcr,raf,srf,pef,x3f");

for(var a in thumbs){

var thumb = thumbs;

md = thumb.synchronousMetadata;

md.namespace =  "http://ns.adobe.com/photoshop/1.0/";

var filename = decodeURI(thumbs.name);

var Credit = md.Credit ? md.Credit : "" ;

var Source = md.Source ? md.Source : "" ;

$.writeln(filename + "," +Credit + "," + Source);

}

SuperMerlin
SuperMerlinCorrect answer
Inspiring
November 25, 2016

Example to be run from Extendscript Toolkit.

#target bridge;

var thumbs = app.document.visibleThumbnails;

//file types to process

thumbs = app.document.getSelection("jpg,tif,gif,eps,psd,pcx,png,eps,crw,cr2,tiff,raw,rw2,dng,nef,orf,erf,mos,dcr,raf,srf,pef,x3f");

for(var a in thumbs){

var thumb = thumbs;

md = thumb.synchronousMetadata;

md.namespace =  "http://ns.adobe.com/photoshop/1.0/";

var filename = decodeURI(thumbs.name);

var Credit = md.Credit ? md.Credit : "" ;

var Source = md.Source ? md.Source : "" ;

$.writeln(filename + "," +Credit + "," + Source);

}

pixxxelschubser
Community Expert
Community Expert
November 25, 2016

SuperMerlin

really does live up to its name!

Great. That's 9 out of a possible 10 points.

Thank you very much.

But unfortunately it does not work with *.bmp and *.pcx --> thumbs = app.document.getSelection("bmp,pcx");  //"undefined is not an object"

Stephen Marsh
Community Expert
Community Expert
November 25, 2016

Do these file types support this metadata? The Bridge Metadata panel GUI would appear to suggest that this is not possible.

ExifTool has issues with BMP too. Using the following command:

exiftool -XMP-photoshop:Credit=ABC -XMP-photoshop:Source=123 '/Users/currentuser/Desktop/test.bmp'

Has the following error: “Error: Writing of BMP files is not yet supported, 0 image files updated, 1 files weren’t updated due to errors”

And as for PCX: “Error: Writing of this type of file is not supported, 0 image files updated, 1 files weren’t updated due to errors”