Skip to main content
Known Participant
May 20, 2015
Answered

extract metadata

  • May 20, 2015
  • 2 replies
  • 2200 views

Hi All,

I want to extract metadata from bridge. I have 10000 images and need to get the file size, resolution, width n height and color mode/space.

I have lots of scripts by downloading from net. But those weren't providing the resolution and color mode specifically. But these both are important for me.

Thanks for your help!

Purushoth

This topic has been closed for replies.
Correct answer I have gone

There is a script "Extract Metadata" in the Bridge section at http://www.ps-bridge-scripts.talktalk.net/ that will allow you to do this.

2 replies

stevenb37729155
Participant
September 30, 2015

I was wondering if anyone knows of any resources that will allow me to extract keyword metadata but keep it organized according to my keyword hierarchy. With my parent keywords as the column headings in my excel spreadsheet.

Inspiring
May 21, 2015

This will create a csv file on the desktop.

Copy and paste the script into ExtendScript Toolkit or a PLAIN TEXT editor.

Then save it out as filename.jsx

The correct folder to save the script can be found by opening Bridge, going to the preferences - Startup Scripts and clicking on the "Reveal my startup scripts" button.

Once saved close and re-start Bridge and accept the new script.

To use, selected the folder you want then Tools - Extract Metadata

#target bridge  

   if( BridgeTalk.appName == "bridge" ) { 

extractMetadata = MenuElement.create("command", "Extract Metadata", "at the end of Tools");

}

extractMetadata.onSelect = function () {

var CSV = new File (Folder.desktop + "/" + decodeURI(Folder(app.document.presentationPath).name) + time() +".csv");

CSV.open('w');

app.document.deselectAll();

CSV.writeln("File Name,File Size,Resolution,Width,Height,Colour Mode");

//add or remove file types to process.

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

for(var a in sels){

var thumb = sels;

if(thumb.type !='file') continue;

app.synchronousMode = true;

thumb.core.thumbnail.thumbnail;

var ColourMode = thumb.core.quickMetadata.colorMode;

var Height = thumb.core.quickMetadata.height;

var Width = thumb.core.quickMetadata.width;

var Resolution = thumb.core.quickMetadata.xResolution;

if(Resolution == 0) Resolution = 72;

if(ColourMode == undefined) ColourMode = 99;

switch (Number(ColourMode)){

    case 0: ColourMode = 'Bitmap'; break;

    case 1: ColourMode = 'Grayscale'; break;

    case 2: ColourMode = 'Indexed Color'; break;

    case 3: ColourMode = 'RGB'; break;

    case 4: ColourMode = 'CMYK'; break;

    case 7: ColourMode = 'Multichannel'; break;

    case 8: ColourMode = 'Duotone'; break;

    case 9: ColourMode = 'Lab'; break;

    default : ColourMode = 'Untagged'; break;

        }

var Line = decodeURI(thumb.spec.name) + ","+ thumb.spec.length + "," + Resolution + "," + Width + "," + Height + "," + ColourMode;

CSV.writeln(Line);

    }

CSV.close();

alert(decodeURI(CSV.name) + " has been saved to the desktop");

function time(){

var date = new Date();

    var d  = date.getDate();

    var day = (d < 10) ? '0' + d : d;

    var m = date.getMonth() + 1;

    var month = (m < 10) ? '0' + m : m;

    var yy = date.getYear();

    var year = (yy < 1000) ? yy + 1900 : yy;

    var digital = new Date();

    var hours = digital.getHours();

    var minutes = digital.getMinutes();

    var seconds = digital.getSeconds();

    var amOrPm = "AM";

    if (hours > 11) amOrPm = "PM";

    if (hours > 12) hours = hours - 12;

    if (hours == 0) hours = 12;

    if (minutes <= 9) minutes = "0" + minutes;

    if (seconds <= 9) seconds = "0" + seconds;

    todaysDate = "-" + hours + "_" + minutes + "_" + seconds + amOrPm;

    return todaysDate.toString();

};

};

Inspiring
June 25, 2015

HI, I need to only extract the pixel dimensions metadata from a folder of images into a .csv file. I wondered if you could tell me if your script could be modified to just include the pixel dimensions?

Thanks in advance.

I have goneCorrect answer
Inspiring
June 25, 2015

There is a script "Extract Metadata" in the Bridge section at http://www.ps-bridge-scripts.talktalk.net/ that will allow you to do this.