Feature #9688

More exif fields to LUA script

Added by Attila Gróf over 6 years ago. Updated over 5 years ago.

Target version:
Start date:
Due date:
% Done:


Estimated time:
Affected Version:
hardware architecture:


High level overview

I propose to add a table-like interface to all exif data available through exiv2 to the LUA interface. I find the pyexiv2.metadata interface easy to use. The image object has a metadata field which can be used as an associative array. The exif fields labels are the indices and the values are the actual exif field values.


(all python, though shall be straight forward)
To retrieve the exposure mode (e.g. whether exposure bracketing was used) of image


To retrieve the exposure bias of image

This interface enables retrieving vendor specific exif fields to.

Use case

To identify image exposure bracketted or focus stacked image sequences. The current interface allows to check the date and time when the photo was taken and the exposure time. This can be used to guess image sequences by the fact that those are usually taken quickly one after another. The extra information of other exif fields enables more sophisticated analysis.

Proposed interface

Add metadata table to dt_lua_image_t


would be the way to retrieve the exposure mode.


#1 Updated by Jérémy Rosen over 6 years ago

technically doable, and it's an idea I had in mind... but there are multiple subtle problems to deal with first...

  • I don't like the image.metadata["something"] interface. it's not very lua like. we could so something like image.metadata.Xmp.Title
  • we can't explore existing metadata easily with that API
  • some metadata is cached by DT for internal usage, we need to make sure all is synchronized
  • suche an API would have to be lua specific and wouldn't colaborate will with the rest of DT. we need to implement the generic stuff on the C side before we add a lua API

the idea is good and I have something similar in mind, but it's far from trivial to implement well...

#2 Updated by Attila Gróf over 6 years ago

I understand that the full blown solution requires major effort.

I develop a Lua script that allows generating HDR images using align_image_stack and enfuse by exporting groups of exposure bracketted images. I am stuck with the automatic identification of the groups. The current option (using exif_datetime_taken and exif_exposure to identify image sequences) creates many falls groups. Python prototyping shows that by using the below exif fields falls grouping can be avoided.

How about adding these 2 exif fields only to the Lua interface?

I could help if you give hints.

#3 Updated by Jérémy Rosen over 6 years ago

  • % Done changed from 0 to 20
  • Status changed from New to Triaged

well, we are in deep freature freeze right now so... no. not for 1.4 at least

post 1.4, I will be looking into adding the whole exif thing anyway. If I need to implment fields one by one, I will call on the ML to see what people need.

As a workaround, you can call exiv2 on the command line and parse the result using normal lua facility, you should look in particular into how you can use yield() to execute a command line without blocking the DT lua engine. it's in the API documentation

feel free to ask me some questions (boucman on #wesnoth-dev or on the mailing list) but for the currently frozen release, you will have to do workarounds...

#4 Updated by Tobias Jakobs over 5 years ago

This is something I'd really like to see too. At the moment I can't write a Lua script becaus I don't get Exif.GPSInfo.GPSAltitude in the script. That is annoying.

Also available in: Atom PDF

Go to top