Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit

This matches the real-world behaviour of apps that only set lat/long when
drawing points on a map.

What made this tricky is that up until gexiv2 0.12.2, this was not necessary.
If altitude (or indeed latitude or longitude) were missing, the function would
still return successfully overall as long as at least one piece of data could
be found. However in 0.12.2 this changes so that *all three* components need
to be present for `gexiv2_metadat_get_gps_info` to return `TRUE`.

I am not sure if this change was intentional, so I have filed a bug upstream
with gexiv2, but in the meantime we still need a workaround. Bug report:

Debian Stable as of today ships with 0.12.1, so I couldn't reproduce or test
this locally, but the CircleCI Mac OSX executor is installing a recent version
of the library via homebrew, so if the tests pass there it should be good.

This patch works around the problem by making the altitude (and only altitude)
component of `GpsInfo` `Optional`. This is slightly annoyingly asymmetrical,
but makes sense in reality as there's no reason to have, say, a latitude and
an altitude but not a longitude. The workaround relies on the implementation
detail that gexiv2 upstream happens to check and set latitude and longitude
first, and altitude last. That means that even if we get a `FALSE` return,
the latitude and longitude pointers may nonetheless have been populated, if
the problem was simply that altitude was unset.

For compatibility with various versions of gexiv2, we handle both cases: the
newer behaviour that returns `FALSE`, and also the older behaviour that
returns `TRUE` but has altitude set to `0.0`.

Addresses bug report #42 - #42

  - 0.12.1 version of the code:
  - 0.12.2 version:
  - Commit that made the change:

Git stats


Failed to load latest commit information.
Latest commit message
Commit time


docs-badge  build-badge  coverage-badge  downloads-badge  version-badge  license-badge  reuse-badge  best-practices-badge 

Rust library for working with media file metadata

This crate provides a Rust wrapper around the gexiv2 library, which is a GObject-based wrapper around Exiv2, which provides read and write access to the Exif, XMP, and IPTC metadata in media files (typically photos) in various formats.


API documentation is available online.

Exiv2’s homepage has documentation on available namespaces and tags.

gexiv2’s APIs may also be a useful reference, along with Exiv2’s API docs.

During development and testing, the Exiv2 command-line utility may come in handy.

Setup & Dependencies

rexiv2 requires Rust 1.63 or newer, and uses the 2021 edition of the language.

Being a wrapper for gexiv2 and Exiv2, rexiv2 obviously depends on them. These libraries are not bundled with rexiv2: you will need to install them separately.

gexiv2 is supported from version 0.10 onwards, and Exiv2 from version 0.23.

For full instructions on how to get started with rexiv2, including how to install the prerequisite dependencies, refer to the SETUP file.

Note that if you want BMFF support (e.g. HEIC, HEIF, AVIF, CR3, JXL/bmff files) you will need an up-to-date version of the underlying libraries (at least gexiv2 v0.13.0 and Exiv2 v0.27.4). You will also need to ensure that your version of Exiv2 has BMFF support enabled. This is generally enabled by default, but may be switched off in certain distributions due to licensing issues.

Versioning & History

rexiv2 is currently available as a pre-1.0 development version.

Version numbers follow the principles of Semantic Versioning.

No further breaking API changes are planned, but they are possible as a result of feedback on the API as more users try it out. Such feedback is welcome, and having the API tried out in real applications is part of ensuring it’s ready for a 1.0 release.

See the CHANGELOG file for a history of released versions.

Optional Features

raw-tag-access: If you need access to the raw byte values of tags, you can enable this feature and gain the get_tag_raw function.

This feature is disabled by default because it introduces a new dependency on glib-sys, and consequently on the GLib system library.

Contributions & Bug Reports

Contributions are gladly accepted, either through GitHub pull requests or by mailing patches to (PGP key 8569B6311EE485F8).

By contributing, you are agreeing to make your contribution available under the same license terms as the rest of the project.

Bug reports and feature requests can also be sent through GitHub Issues or by email, and are very welcome and appreciated.

Reports of security issues can also be sent privately to the email address and PGP key given above.

For more information, see the CONTRIBUTING file.

Copyright & License

The Exiv2 and gexiv2 libraries are both released under the terms of the GNU General Public License (GPL), and since rexiv2 is linked to them, it too is made available under the terms of the GPL. Specifically:

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see

Please refer to the LICENSE file for a full copy of the license.


Rust library for read/write access to media-file metadata (Exif, XMP, and IPTC)








No packages published