Show EXIF metadata of pictures in DT?

Hi there,

I regulary move photos taken by smartphone out of my photos app into a DEVONthink database, e.g. meter readings.

The added/generated/modified date in the inspectors reads the date when I moved the picture.
This is mostly irrelevant. More of interest is the date and time the picture was shot.

Is there any chance to read the EXIF data within DT?
If not, this would be a good functionality of the inspector.
At leat to show the record date and GPS data.
This would save the necessity to open a third party app to look up the information in the file.

Best regards and stay healthy
Herb

Some of the embedded metadata is shown in Tools > Inspectors > Document > Properties. In addition, importing uses available geolocation information and the geolocation should be shown in the Info inspector.

Thanks for the prompt reply.
Right, the GPS location is shown as city/country.

There is no access to relevant EFIX data.
There is the tab “user defined” (I am using the german language version – this the guessed englisch name for “Benutzerdefiniert”).

Is this maybe a measure to pull EXIF data?
Is there a chance to define something for EXIF access?

So far, I open up the photo file in GraphicConverter to look up the EXIF data for the date and time the picture was shot.

My feature request:
Please show the record time of jpg and other photos formats.

TIA Herb

The time isn’t supported yet but other information (e.g. comment, description, copyright, keywords etc.) isindexed/searchable and shown in the Document Properties inspector.

Any news regarding DT able to read the original recording date and time of a picture in jpg format?

Currently there’s no dedicated support for viewing EXIF metadata.

That is a pity.
Especially the original recording date and time is very relevant.
It is annoying that I have to open a third party app (e.g. graphic converter) to look up the date and time of a picture.
DT stands for working efficiently with files and information.
Please put it on your list
TIA

That is one of the wonderful things about DEVONthink, in my experience. It’s so easy to click into another app to do even more with the file than DEVONthink does. It’s part of a great ecosystem.

1 Like

Whilst there is no direct way to extract that data using AS or JS, a quick internet search shows numerous methods of doing so; you could set up a smart rule to access the EXIF data of any photo using AS/JS, and automatically copy that data to custom metadata. Sure, that’s a workaround, but it should be quite doable.

There is a promising looking suggestion on how to extract EXIF data using JS on stackoverflow; I have not tested this myself, but the sample script looks as though it could be adjusted to suit. There are numerous examples of how to use JS in a smart rule here on the forums, and users who are usually prepared to point you in the right direction if you get stuck and post the code you are working on.

3 Likes

But there is:

(() => {
  const app = Application("DEVONthink 3")
  const IE = Application('Image Events');
  app.includeStandardAdditions = true;
  const recs = app.selectedRecords();
  // Loop over all selected records
  recs.forEach(r => {
   // Get path of current record
    const p = r.path();
   // Skip over every record that's not a jpeg image
    if (!(r.type() === 'picture' && /\.jpe?g$/i.test(r.path()))) 
      return;
    // Open the file as an image
    const image = IE.open(p);
    // Get the image's metadata
    const metaData = image.metadataTags();
    // Loop over the metadata
    metaData.forEach(m => {
      // If the current metadata is 'creation', get its value and
      // convert to a JS date
      if (m.name() === 'creation') {
        const rawDate = m.value().replace(/(\d{4}):(\d\d):(\d\d) /,"$1-$2-$3T");
// OPTIONAL (remove comments!): set record's creation date to date of image.
        // r.creationDate = new Date(rawDate);
      }
    })
    IE.close(image, {saving: 'no'});
  })
})()

This works for some image data (notably the creation date), but not for all EXIF data.

These solutions rely on external libraries that are not easy to import into JXA scripts. It should be possible to use a pure JXA solution based on the NSImage framework, but I don’t have the time to investigate that right now.

As you said, an alternative might be to script GraphicsConverter (if that’s already installed) or simply shell-script exiftool.

3 Likes

Thanks for adding your expertise Christian, and especially for pointing out (once again) the subtle difference between JS and JXA.

While we generally don’t suggest dependencies, their installation and use is up to the individual. So in this case, I’d agree that the venerable old exiftool would prove useful to @Herb.

2 Likes

It actually is possible, and I posted sample code in a new thread. This code can potentially get all EXIF data, which is a lot more than Image Events are willing to deliver.

2 Likes

You missed the important point:
If relevant metadata of a file are not directly accessible by DT, you cannot filter, sort or organise the files. And this is the key value of DT for me, that I can dump “all my life” into DT und will be able to find easily the information later again.

Hello Blanc, thank your for your suggestions. It makes me a bad conscious, since I am not fluent in scripting. I am sure that others will be able to make use of your thoughts.

Thank you for suggesting EXIFTOOL. Currently I retrieve the JPG metadata with GraphicConverter, which is my macOS standard app. It offers a window for the metadata.
To use the EXIFTOOL requires extra steps, like using the open with menu, etc.
This reminds me on one convenient feature request:
The ability to define an alternative app to open a file.
My everyday experience ist that I open my PDFs with either PDFexpert or with Preview.
It would be great if DT would over to open a secondary app by the use of the ALT key.

I didn’t miss it. I think you may have misunderstood what I said. I’ll say it a different way.

Put as much stuff into DEVONthink as you want. As long as that stuff is “searchable” or organised into real or virtual “groups”, you will be able to find it. How “easily”? Up to you I guess. And, you don’t have to use DEVONthink built-in features to view/edit/handle everything, e.g. store your Pages/Word documents in DEVONthink, but use Pages/Word to work with them. The “ecosystem” is Apple’s Mac “ecosystem” and is there to be used. People here have even kindly given you tips on you can use that ecosystem to “bend DEVONthink to your will”.

Most experienced users of DEVONthink recommend not putting *everything" i.e. “all my life” into DEVONthink. No reason for you to follow that recommendation if that not what you want, though.

1 Like

Which metadata do you actually need to be available in DT (and do you use the Pro version of DT)?

In addition to what @rmschne correctly remarked about „dumping all your life“ into DT: Apple makes it (deliberately?) difficult to retrieve all metadata from images programmatically.
For example, the code I posted (not blanc, btw), will not retrieve the camera maker and model. The framework function is apparently borken, and for a long time already.

So DT would have to include a fully fledged EXIF (and IPTC and XMP) library to get at all the image metadata. To replicate functions that are already available elsewhere. Not a sensible solution, I’m my mind.

So maybe it’s worth your while to take a step back and think about using an app that’s made to manage images instead.

1 Like

I am confused about what you want to tell me.
You talk about editing/viewing … – again, that is not my subject.
Furthermore, I don’t need anybody’s blessing what I put into DT.
And yes, this time you mentioned it, it is about search ability. Metadata DT can’t access, cannot be used for sorting or filtering. If I have a text file, the file creation or chance date is doing the trick. If it comes to JPG files the file system data are worthless. For my use case, the original record date and time of a picture is of interest.
In the past I used Apples Aperture app. It allowed to name the JPG with the record time and date. Then apple discontinue this powerful program and with Photos app, I have no measures to rename the file.
Don’t worry, I don’t store my 35000 photos in DT. Only photos belonging to projects in DT are exported to DT.
I appreciate the support on blanc and others. I did not start so far with tweaking DT with scripts and other programming. As a MSEE, I’d enough brain to master it. It is a conscious decision not to open this time consuming box. I already busy enough with many other subjects.