Swiftpack.co -  kradalby/SwiftExif as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
Swift wrapper around libexif
.package(url: "https://github.com/kradalby/SwiftExif.git", from: "0.0.6")


SwiftExif is a wrapping library for libexif and libiptcdata for Swift to provide a JPEG metadata extraction on Linux and macOS.

SwiftExif was written to facilitate porting the Munin image gallery generator to run on both Linux and macOS (it previously required ImageIO/CoreGraphics).

libexif is used to extract and format the EXIF data from the image, while libiptcdata extracts the "newer" IPTC standard.


  • Linux (Ubuntu 20.10 tested) or macOS (10.15 tested)
  • Swift 5.2 (or newer)
  • libexif 0.6.22 (available in Homebrew or Ubuntu 20.10)
  • libiptcdata 1.0.4


On Ubuntu/Debian based Linux:

apt install -y libiptc-data libexif-dev libiptcdata0-dev

On macOS using brew:

brew install libexif libiptcdata

Swift Package Manager

Add SwiftExif to your dependencies:

dependencies: [
  .package(url: "https://github.com/kradalby/SwiftExif.git", from: "0.0.x"),


SwiftExif aims to provide some simple helper functions that essentially returns all the data as dictionaries.

For example:

import SwiftExif

// Read a JPEG file and return an Image object
// Note: current error behaviour is to return empty dictionaries, no error is thrown.
let exifImage = SwiftExif.Image(imagePath: fileURL)

// Get a [String : [String : String]] dictionary. The first dictionary has items
// from the spec e.g. 0, 1, EXIF, GPS...
// The values are returned in "human readable format".
let exifDict = exifImage.Exif()

// Get a [String : [String : String]] dictionary. The first dictionary has items
// from the spec e.g. 0, 1, EXIF, GPS...
// The values are returned in a "raw" format.
let exifRawDict = exifImage.ExifRaw()

// Get a [String : Any] dictionary.
// Most items are String, however "Keywords" are [String]
let iptcDict = exifImage.Iptc()

In addition to the high-level functions, a set of lower-level functions is available in the different classes. Have a look at the code or the unit tests to see what else you can do.


Stars: 4
Last commit: 1 week ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API