Every photo carries a small block of metadata next to its pixels: where it was taken, when, which way the camera was held, and the settings used. That block is EXIF, and apps need it more often than you would think. You read the orientation to show a picture upright. You read the capture date to sort a gallery. You read the GPS position to place a photo on a map, and you remove it before the photo is shared.

Each of those has a catch. A capture date without its time-zone offset is not a moment in time. A content:// URI from the gallery is not a file path. And since Android 10, the system hides GPS tags from media URIs unless the app asks for the original file.

exif_kit is a Flutter plugin that handles those cases. On Android it reads and writes through androidx ExifInterface. It also ships a JPEG reader written in pure Dart, with no dependencies, that works in unit tests and on any platform with dart:io.

What it does

Typed reads. ExifKit.read(pathOrUri) returns an ExifData object with typed getters: make, model, software, orientation, rotationDegrees, dateTimeOriginal, offsetTimeOriginal, dateTimeOriginalUtc, latitude, longitude, altitude, exposureTime, fNumber, iso, focalLength, width and height. The raw tags map is there too, for anything without a getter.

Paths and content URIs. It reads file paths and content:// URIs, through ContentResolver.openFileDescriptor. It supports MediaStore.setRequireOriginal, which is how an app gets unredacted GPS on Android 10 and later.

Many formats for reading, three for writing. Reading covers whatever androidx ExifInterface 1.4 reads: JPEG, PNG, WebP, HEIF/HEIC/AVIF, DNG and several camera raw formats. Writing covers JPEG, PNG and WebP.

Writes, one tag or many. ExifKit.write(path, ExifChanges) applies several edits in one save. For the common cases there are one-call helpers: setGps, removeGps, setOrientation and setDateTimeOriginal. strip({keepOrientation}) is a privacy helper that removes the identifying tags and, by default, keeps the orientation so the picture still displays the right way up.

Thumbnail and rotation. ExifKit.thumbnail(source) returns the embedded thumbnail and ExifKit.rotationDegrees(source) tells you how much to rotate the image.

A pure Dart reader. JpegExifReader, also reachable through ExifKit.readFile and ExifKit.readBytes, parses IFD0, Exif, GPS and the IFD1 thumbnail, in little- and big-endian files. It produces the same tag strings as ExifInterface, so the same ExifData getters work on both paths.

Typed errors. Failures are sealed, typed exceptions: ExifFileNotFoundException, ExifAccessDeniedException, ExifWriteNotAllowedException, ExifUnsupportedFormatException and others. You can handle each case on its own instead of parsing a message.

How to use it

Add it from GitHub:

dependencies: exif_kit: git: https://github.com/AbdeldjalilChougui/exif_kit 

Reading and editing a photo:

import 'package:exif_kit/exif_kit.dart'; Future<void> demo(String photoPath) async { final exif = await ExifKit.read(photoPath); print('${exif.make} ${exif.model}, ISO ${exif.iso}, f/${exif.fNumber}'); print('Taken ${exif.dateTimeOriginal} (UTC ${exif.dateTimeOriginalUtc})'); if (exif.hasGps) print('At ${exif.latitude}, ${exif.longitude}'); print('Rotate by ${exif.rotationDegrees} degrees to display upright'); // Edits: the path must be a file this app may write. await ExifKit.setGps(photoPath, latitude: 36.7538, longitude: 3.0588, altitude: 12); await ExifKit.setDateTimeOriginal(photoPath, DateTime(2026, 3, 1, 9, 30), offset: const Duration(hours: 1)); // Several edits in one save. await ExifKit.write( photoPath, ExifChanges() ..strip() // keeps orientation by default ..set(ExifTag.copyright, '(c) 2026 Me'), ); } 

Notice the two dates. dateTimeOriginal is the wall-clock time the camera wrote. dateTimeOriginalUtc combines it with offsetTimeOriginal, so two photos taken in different time zones sort correctly. When you set the date yourself, you pass the offset along with it.

Reading from the gallery

final exif = await ExifKit.read( 'content://media/external/images/media/42', requireOriginal: true, // needs ACCESS_MEDIA_LOCATION on Android 10+ ); 

Reading another app's image needs READ_MEDIA_IMAGES on API 33 and later, and READ_EXTERNAL_STORAGE before that. Without the permission, read throws ExifAccessDeniedException. The same happens with requireOriginal: true when the app does not hold ACCESS_MEDIA_LOCATION. Files that are not JPEG, PNG, WebP, HEIF or DNG throw ExifUnsupportedFormatException.

Writing needs a file you own

All the write calls edit the file in place. They need an absolute file path that your app is allowed to write: a file in your app's own directories (documents, cache, temp), or a shared-storage file your app created or has write access to.

They do not accept content:// URIs. For those, and for files the app cannot write, they throw ExifWriteNotAllowedException. To edit an image the user picked, copy it to a file you own, edit the copy, then save it where it needs to go, for example through MediaStore.

Without Android

final data = JpegExifReader.read(jpegBytes); // any platform final thumb = JpegExifReader.thumbnail(jpegBytes); 

This is the path to use in unit tests, in a Dart script, or on a platform where the native side does not exist.

Things to know

  • Android only. iOS is not supported. On other platforms, only reading JPEG files works, through the pure Dart reader. Writes throw ExifUnsupportedPlatformException.
  • Writing is limited to JPEG, PNG and WebP. ExifInterface cannot save HEIF, DNG or raw files.
  • strip does not remove the embedded thumbnail. It removes the tags ExifInterface knows, including GPS, dates, camera, lens and body serials, owner, user comment, maker note and XMP. But ExifInterface re-writes the embedded EXIF thumbnail, which is a small copy of the original picture. If you need that gone too, re-encode the image.
  • The Dart reader has a core tag set. JPEG only, with IFD0, Exif, GPS and the IFD1 thumbnail. It does not parse maker notes, XMP or IPTC.
  • Redacted GPS arrives as zeros. On Android 10 and later, GPS tags in media URIs are redacted unless the app holds ACCESS_MEDIA_LOCATION and passes requireOriginal: true. The redacted values come as zeros with empty reference tags. latitude, longitude and hasGps treat that as "no GPS", but the raw zero strings stay in tags.
  • What was tested. The example app has an emulator integration test. It writes and re-reads GPS, orientation and dates, strips them, checks the result against the pure Dart reader, and reads the image back through a MediaStore content:// URI with and without the media permissions. It ran on the Android Emulator with the Pixel 10 system image, API 37. The README states that it was not yet tested on a physical phone or with HEIF/DNG camera files.

The JPEG fixtures used by the tests are synthetic solid-colour images generated for the package, so no third-party photos are shipped.

Why I built it

The details around EXIF are where the bugs are. A photo taken in portrait shows sideways because nobody read the orientation tag. A timeline is off by an hour because the offset was ignored. A map shows a point at latitude 0, longitude 0 because the system redacted the GPS and the zeros were taken as a real position. A "remove location" button reports success on a content:// URI the app could never write.

I wanted one API where those cases are named and typed: an explicit UTC date, a hasGps that understands redaction, a requireOriginal flag, and write calls that fail with a clear exception instead of doing nothing. The pure Dart reader came from the testing side: code that reads EXIF should be testable with flutter test, without a device, and get the same tag strings as on Android.

Get the code

The source, the README, the example app with its integration test and the fixtures generator are on GitHub: https://github.com/AbdeldjalilChougui/exif_kit. It's MIT licensed. Issues and pull requests are welcome, especially reports from physical devices and HEIF or DNG files.

Originally published at abdeldjalilchougui.biz.