ExifStripper
Dependency-free utilities for working with EXIF and related metadata.
Currently provides:
- Lossless GPS stripping (no re-encode) from EXIF and XMP (including DJI drone positions) in JPEG, WebP, PNG, TIFF and ISO-BMFF (HEIC/AVIF). Files are processed without reading the image data into memory.
- Description extraction from common metadata (EXIF/IPTC/XMP)
Installation
The package can be installed
by adding exif_stripper to your list of dependencies in mix.exs:
def deps do
[
{:exif_stripper, "~> 0.1.3"}
]
end
Usage
Strip GPS metadata in-place (returns :ok, :noop or {:error, reason}):
ExifStripper.GpsStripper.strip_gps_data("/tmp/in.jpg", "/tmp/in.jpg")
Malformed metadata returns an error and leaves the output unchanged. When input and output are the same file, JPEG, WebP, HEIC and TIFF files are patched in place (through symlinks and hard links). PNG files and other outputs are written to a temporary file next to the output, which then replaces the output path.
Read a description:
ExifStripper.Description.read_file("/tmp/image.jpg", max_length: 500)
Tests
The test suite uses exiftool as an oracle, so exiftool must be available in PATH.