Automate showing EXIF with pictures

Started Jan 18, 2005 | Discussions thread
ForumParentFirstPrevious
Flat view
Regit Young Veteran Member • Posts: 5,975
Automate showing EXIF with pictures

Sometime ago, Sander asked my about automating the task of showing what kind of lens is being used in the pictures... I didn't know this question till I searched for my name a moment ago!!! Sorry Sander...

In any case, this info may be useful to some... But first, a couple of samples:

In short, you can Basically, I've adapted a javascript (can't remember where the original is from) and you can run this from Photoshop; i.e. File-> Scripts-> Browse

Do remember that this script will work in PS CS, earlier version may need some changes to the way key variables are called/defined. Also, the EXIF info must be well-formed; so directly importing RAW, NC4, etc. is ok. If EXIF is tempered previously, it will not work...

Also, this will be limited as if you have many lenses in the same range, the script can't tell which is which?!?! I've yet to able to extract Max. aperture info, perhaps that may help.

Here's the script. In essence, it is a matter of matching EXIF info with focal length of the lens ... Save the script as something xxx.js and call the script in PS CS, again, File-> Scripts-> Browse

//---------
displayDialogs = DialogModes.NO;
var defaultRulerUnits = preferences.rulerUnits;
preferences.rulerUnits = Units.PIXELS;

function explodeArray(item,delimiter) {
tempArray=new Array(1);
var Count=0;
var tempString=new String(item);
while (tempString.indexOf(delimiter)> 0) {
tempArray[Count]=tempString.substr(0,tempString.indexOf(delimiter));

tempString=tempString.substr(tempString.indexOf(delimiter)+1,tempString.length-tempString.indexOf(delimiter)+1);
Count=Count+1
}
tempArray[Count]=tempString;
return tempArray;
}

var AD = activeDocument;
var resRatio = AD.resolution/72;

if(resRatio!=1){
AD.resizeImage(AD.width.value,AD.height.value,72);
}

var heightVar = AD.height.value+2;

var black = new SolidColor();
black.rgb.red = black.rgb.green = black.rgb.blue = 0;

var white = new SolidColor();
white.rgb.red = white.rgb.green = white.rgb.blue = 255;

backgroundColor = black;

AD.resizeCanvas(AD.width.value+8,AD.height.value+8,
AnchorPosition.MIDDLECENTER);
AD.resizeCanvas(AD.width.value,AD.height.value+60,AnchorPosition.TOPCENTER);

var exifData = AD.info.exif.toString();
explodeArray(exifData,",");

for(n = 0; n

var stringTemp=tempArray[n]
if(stringTemp.indexOf("Exposure Time")!=-1){
var expTime = tempArray[n+1];
}

if(stringTemp.indexOf("Focal Length")!=-1){
var focLength = tempArray[n+1];
}

if(stringTemp.indexOf("F-Stop")!=-1){
var aptNum = tempArray[n+1];
}

if(stringTemp.indexOf("ISO Speed Ratings")!=-1){
var ISONum = tempArray[n+1];
}

Use this to note the lens use.
Basically, just calculate the 35mm equi of the lens and plug in the figure.
Or simply look at the EXIF info from PS CS
For zoom, just use a range.

if(focLength> =18 && focLength
var Lens = "Nikkor 12-24mm 1:4";
}
if(focLength=="42"){
var Lens = "Nikkor 28mm 1:2.0";
}
if(focLength=="82"){
var Lens = "Micro-Nikkor 55mm 1:3.5";
}
if(focLength=="87"){
var Lens = "Noct-Nikkor 58mm 1:1.2";
}
if(focLength=="127"){
var Lens = "Nikkor 85mm 1:1.4";
}
if(focLength=="157"){
var Lens = "UV-Nikkor 105mm 1:1.4.5";
}
if(focLength=="72"){
var Lens = "Macro-Nikkor 65mm 1:4.5";
}

if(stringTemp.indexOf("Date Time Original")!=-1){
var phoTime = tempArray[n+1];
var dateArray1 = phoTime.split(" ", 1);
phoTime = dateArray1[0];
var dateArray2 = phoTime.split(":");
var monthsArray =["January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December"];
phoTime = monthsArray[dateArray2[1]-1]+" "+dateArray2[2]+" "+dateArray2[0];
}

if(stringTemp.indexOf("Model")!=-1){
var cameraModel = tempArray[n+1];
}
}

change the name here!!!

var nameLayer = AD.artLayers.add();
nameLayer.kind = LayerKind.TEXT;
var TI = nameLayer.textItem;
TI.position = [5,heightVar+16];
TI.contents = "© Regit Young 2005";
TI.font = "Arial";
TI.size = 14;
TI.color = white;
TI.fauxBold = true;

var infoLayer = AD.artLayers.add();
infoLayer.kind = LayerKind.TEXT;
var TI = infoLayer.textItem;
TI.position = [5,heightVar+30];

TI.contents = cameraModel+" with "+Lens+" @ "+focLength+"mm (35mm equiv), "+expTime+", "+aptNum+", ISO: "+ISONum+"\u000DDate photo taken: "+phoTime;
TI.font = "Arial";
TI.size = 11;
TI.color = white;

AD.flatten();
//-----

-- hide signature --

Regit Young regit@westnet.com.au
FCAS Member, PBase Supporter
http://www.pbase.com/regit

ForumParentFirstPrevious
Flat view
Post (hide subjects) Posted by
FKS
ForumParentFirstPrevious
Keyboard shortcuts:
FForum PPrevious NNext WNext unread UUpvote SSubscribe RReply QQuote BBookmark MMy threads
Color scheme? Blue / Yellow