Columns: Extended EXIF (Picasa faces e.g.)

ExtendedExif - Script columns for extended and custom exif information. If you do not edit the script, it will add the following columns.

ExifTool-Columns:

  • Lens ID (the lens used on your camera, the script adds lens-ids for some panasonic lumix models, where they are missing in the exif data)
  • Crop Factor (is available normally nowadays, the script sets a crop factor for a specific model though, showing how to enrich tag information by yourself)
  • HF Distance (hyperfocal dinstance)
  • Focus Mode
  • Shutter (modern cameras have mechanical and electronic shutters)
  • Faces (picasa face region names)
  • ICC Profile (the ICC color profile used (Adobe RGB, sRGB, Grayscale etc.)
    Native-Columns:
  • Ratio (4:3, 3:2 or 16:9 etc. / calculation of ratio is "soft", image dimensions may depart by 2-4% from common ratios)
  • Orientation (Landscape or Portrait)

These columns serve as an example, you can create your own columns for any information exiftool.exe or DOs metadata object spits out.

Features and requirements:

  • optional persistent storage of exiftool data to increase speed (100x and more, especially when searching these columns)
  • name, label, justify, default value can be set for each column separately
  • supports callback functions to override (missing) exif values with custom calculations/texts or calculate your own (watch "LensID", "Ratio" and "Orientation" columns)
  • requires exiftool.exe for exiftool-type columns (edit path in config section of script) - download here: sno.phy.queensu.ca/~phil/exiftool/
    Notice: If you configure the script to keep the exiftool data, it will create a mirrored directory structure to help clean and maintain this "kind of" database.

Example:





Column-Setup:
Notice how the first column makes use of a callback "GetLens" to fix missing exif data based on information exiftool.exe provides.
The native columns "Ratio" and "Orientation" make use of callbacks as well, but work on DOs metadata instead of data provided by exiftool.


DO-Config:
The path to the exif tmp-files will be created automatically (%tmp% will be replaced by standard windows tmp directory). If you leave the path blank, windows tmp directory will be used.


Helper-Button:
This is to help finding the correct tag group and tag name for use in the head of the script (edit the file). The button dumps all exif information of a file to console window. Look for separators like "---- GroupName ----" to find the group your tag belongs to. Then use that group- and tagname to setup your column. The path to exiftool.exe needs to be adjusted.

<?xml version="1.0"?>
<button backcol="none" display="both" textcol="none">
	<label>Dump Exif-Data</label>
	<icon1>#newcommand</icon1>
	<function type="batch">
		<instruction>@filesonly </instruction>
		<instruction>@leavedoswindowopen</instruction>
		<instruction>@nodeselect </instruction>
		<instruction>/home/tools\exiftool.exe -s -a -u -g1 {f}</instruction>
	</function>
</button>

Installation:
To install the columns, download the *.js.txt file below and drag it to Preferences / Toolbars / Scripts.
After that, right click any listers column header and add the columns from the "script" submenu.

Download:

4 Likes

Updated to v0.4:

  • support for "native" columns based on dopus native metadata (no exiftool required for these)
  • new native columns "Ratio" and "Orientation"

Those added native columns support callbacks as well. "Ratio" and "Orientation" show how to use these. If you activate native columns only, there's no execution of exiftool.exe in the background. There may be a mixed mode one day, but until now the need has not been there to have a meshup of information delivered by DO and exiftool.

Hi tbone,

thanks for a very good idea and an excellent example to learn scripting from! I'm only just beginning with DOpus Script (though I have JS experience) and one of the things I wanted to do was creating metadata columns for mkv videos, which is already possible with your script (since the exiftool does a lot more than read Exif tags in images). Great! :slight_smile:

I have a few questions/remarks (I hope you don't mind):

  • The path to my exiftool contains spaces, therefore the configured 'exiftoolPath' needs to be enclosed in quotes in line 195.

  • The caching mechanism (if 'keepTmp' is set) uses the files' folders, but ignores the drive they are on. So if two files are on two drives with the same folder structure, they would use the same cached file. I changed line 178tmpFile.path = tmpFile.path+"\\"+filePath.substring(3);
    to

tmpFile.path = tmpFile.path+"\\"+filePath.replace(":", "");
to solve that.

  • A little more complicated: There is no way of 'refreshing' the cache once it was created (except manually deleting it), is there? What happens if the metadata in a file change? Wouldn't the script still display the old data? I guess the files' timestamp should be included in the cache somehow...

That's all for now,
thanks & greetings from Hamburg,
MartO

Thanks! o) Helpful? Mhh, after adding the "native" columns, the code needs some cleaning actually, but if you still find your way through, good! o)
Thanks as well for reporting the issues you found. I will take these into account for the next update of course.

I agree, the "cache-thing" is something to put more brain into. It is exactly the way you analyzed it, currently there's no auto-trigger to update cached data if the meta-data in the file changed. That said, I'm not so convinced anymore on putting the cache where it is right now. I already investigated a bit on different solutions, I guess what I'd go for in an upcoming version, is to add a files metadata into the same place DO puts its metadata. The Alternate Data Streams of the NTFS filesystem, so any cached data would be part of the file and stick to it when moving it around.

Another "todo" is to change the format of the cache, it's the plain exiftool output right now, which needs unnecessary reparsing when reading and is no good for adding additional details (file datestamp eg.).

So yes, this still needs some work! o)

Updated to v0.5

  • resolves exiftool path
  • exiftoolpath in quotes
  • black/white list of extensions
  • supports automatic updates/scriptwizard

Updated to v0.5.1

  • added a new exiftool column "ICC Profile"

I got upset by various applications not handling the colorprofile of an image correctly, so images suddenly look very different regarding color and contrast.
The new column helps me to identify images more easily which will not be handled correctly, so I can convert them beforehand (with Lightzone or IMagick e.g.).

Thanks for great script. Is it possible to get it work with tif files? I don't see any color profile information for tif files, just jpegs.

Edit: I can simply be done with correcting preferences of the script:


Good! You found it yourself. o) Sorry for the outdated screenshot, it's updated now to display all of the options.

I created an account just to thank you for this.
I have been looking for a way to get DOPUS to identify which of my Google Pixel Photos have embedded video clips in them.

I use DOPUS to rename photos to

{shootingtime|D#yyyy} \ {datetaken|D#YYYY-MM-dd.T#HHmmss} - {cameramodel}

But then I realized I had no idea which photos had embedded video clips in them.

I know almost nothing about coding in JS.

But I was able to add the following lines

//	           col-name						groupname			tagname						
	new Column("Micro Video",		"XMP-GCamera",	"MicroVideo",				"Micro Video",		"right",		"",				GetMV),

///////////////////////////////////////////////////////////////////////////////
// GetMV(): get motion video
function GetMV(tags, column, data){
	if (tags["XMP-GCamera"]["MicroVideo"]="1")
		return "MV";
	return "None";
}
///////////////////////////////////////////////////////////////////////////////

This checks for the Tag MicroVideo and adds MV to the column.

I do have a few questions.

  1. I get script errors when the photo doesn't include the group "XMP-GCamera". Is there a way to tell it to ignore if the tag or group don't exist?
XMP-GCamera' is null or not an object (0x800a138f)
 9/18/2019 10:46 AM Column.File: ExtendedEXIF:  Error at line 103, position 2
  1. Right now I manually choose a different rename command on the photos that have "MV" in the column. But does someone know how to write a rename script that checks to see if that column data matches MV and then change how it renames based on its finding?

I would love the end result to automatically change photos to

2019-01-01.151746 - Pixel 2 XL.jpg
2019-03-16.175929 - Pixel 2 XL [MV].jpg

Automatically detecting if there is embedded microvideo.

Thanks again.

Your function seems to have a little fault since it assigns "1" instead of comparing (use == in this case).
To prevent the "is null or not an object.." error, check for the group first, if that exists, check for the sub item. All fixed down here:

///////////////////////////////////////////////////////////////////////////////
// GetMV(): get motion video
function GetMV(tags, column, data){
	if (tags["XMP-GCamera"] && tags["XMP-GCamera"]["MicroVideo"]=="1")
		return "MV";
	return "None";
}
///////////////////////////////////////////////////////////////////////////////

Regarding the rename, not sure if DO is capable of pulling ["XMP-GCamera"]["MicroVideo"] natively by now, if not then there might be ways to pull values from scripted columns in other script by now. Unfortunately I didn't follow development very closely in the recent months, but with one of these we should be able to put a 3 liner/button together which does your "MV" rename.
If these two ways aren't possible, another option is to use a find with that column & value and applying your rename on the find result. This might be cumbersome for single/few items though, but should be ok for mass-renaming.

This Rename preset adds the new column's content. The little script inside removes it if it is None.

You'll need to replace {scp:ExtendedEXIF/MicroVideo} with the column name on your system.

18885.orp (578 Bytes)

Reference:

{shootingtime|D#yyyy} \ {datetaken|D#YYYY-MM-dd.T#HHmmss} - {cameramodel} [{scp:ExtendedEXIF/MicroVideo}]
function OnGetNewName(getNewNameData) {
var tmpStem = getNewNameData.newname_stem;
var tmpExt = getNewNameData.newname_ext;

tmpStem = tmpStem.replace(/ \[None\]$/, '');

return tmpStem + tmpExt;
}

Thx, very good @lxp, I didn't think of rename scripts! o)

You all are awesome! I really appreciate the quick response.

The change in the column code fixed the error and the not having "None" show up.

I am having an issue with the rename script. It seems to stem from the "/" in the column name. It wants to convert that into a subdirectory. Is there some form of quotes or parentheses to tell the script to ignore the "/" in ExtendedEXIF/Micro Video

Thanks

Simply pick it from the dropdown in the right end of the new name field:

Side note: I noticed some problems with the forward slash, too. Could be a bug. Make sure to set mode to regex, like in the .orp I posted.

1 Like