lensfun: Database file format

lensfun 0.3.95.0

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">

        <mount>
            <name>Pentax K</name>
            <compat>M42</compat>
        </mount>

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

        <camera>
            <maker>Pentax</maker>
            <model>Pentax K10D</model>
            <mount>Pentax KAF2</mount>
            <cropfactor>1.531</cropfactor>
        </camera>

    </lensdatabase>

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.

- Describing camera mounts: <mount>
- Declaring cameras: <camera>
- Declaring lenses: <lens>