Database file format

Here goes a simple lens database file, I hope I don't have to explain much what is what, as the format is pretty much self-documenting.

<lensdatabase version="1">

        <name>Pentax K</name>

        <model>SMC Pentax M 50mm f/1.4</model>
        <mount>Pentax K</mount>
        <focal value="50" />
        <aperture min="1.4" max="22" />
            <!-- WARNING: this calibration data is completely bogus :) -->
            <distortion model="ptlens" focal="50" a="0.012" b="-0.036" c="0" />

        <model>Pentax K10D</model>
        <mount>Pentax KAF2</mount>


The “version” attribute at the <lensdatabase> element denotes the format version of this database file. It is an integer number and defaults to “0”. Because it was introduced in Lensfun 0.3, “0” is the format version of all Lensfun releases before that. Database format changes mostly are backwards-compatible, so that a certain Lensfun version supports database versions up to a certain number. The most recent lens database is offered for download in all versions, and the lensfun-update-data program fetches the appropriate for you. See Database format versions for the version history.

Since lenses and cameras may be known with different names in different languages/countries, the library provides a built-in mechanism for name translations. You can provide such multi-language strings for every language you want, and when the library client will ask for string value, it will get the one in the current locale.

This mechanism is also useful sometimes when you want to use a name for camera which is different from the value put in EXIF data. For example:

<maker>Konica Minolta Camera, Inc.</maker>
<maker lang="en">Konica Minolta</maker>
<maker lang="ru">Коника Минольта</maker>

The value without a “lang” attribute is always used for identification, but GUI may use the translated string for display. If no language matches, and an "en" translation is present, it is used. And only if there's no native translation and there's no "en" translation, the no-language version is used.

Here is a complete list of elements recognized by the library and the format of the data within elements.