Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Piexif fork

This is a maintained fork of Piexif. Install the fork distribution with:

pip install piexif-fork

The distribution is named piexif-fork, but it still provides the existing piexif Python module, so existing import piexif code can continue to use it.

See issues.md for fork issue tracking and planned work.

Original Piexif README

Piexif

Build Status Windows Build Coverage Status docs

To simplify exif manipulations with Python. Writing, reading, and more… Piexif is pure Python. To everywhere with Python.

Document: http://piexif.readthedocs.org/en/latest/

Online demo: http://piexif-demo.appspot.com/demo

Install

‘easy_install’:

$ easy_install piexif

or ‘pip’:

$ pip install piexif

or download .zip, extract it. Put ‘piexif’ directory into your environment.

Why Choose Piexif

How to Use

The standard API provides five functions.

  • load(filename) - Get exif data as dict.

  • dump(exif_dict) - Get exif as bytes.

  • insert(exif_bytes, filename) - Insert exif into JPEG, WebP, or PNG.

  • remove(filename) - Remove exif from JPEG, WebP, or PNG.

  • transplant(filename, filename) - Transplant exif from JPEG to JPEG.

Loading, insertion, removal, and transplantation also have explicit byte/file variants: load_bytes() / load_file(), insert_bytes() / insert_file(), remove_bytes() / remove_file(), and transplant_bytes() / transplant_file(). Byte variants always treat their input as image data; file variants always treat it as a path.

patch_bytes() updates existing JPEG EXIF fields without moving or resizing payloads. See the function reference for RawField inputs and restrictions.

replace_thumbnail_bytes(data, thumbnail) replaces an existing JPEG EXIF thumbnail without rebuilding the surrounding metadata. It does not insert a thumbnail when one is absent.

For io.BytesIO output, supply an empty buffer positioned at zero. Writers do not clear or truncate it; they rewind it after writing. To reuse a buffer, call seek(0) and truncate(0) before passing it again.

The advanced API supports nested directory lists:

  • load_ifds(input_data, key_is_name=False, load_jpeg_data=False) - Read directory metadata, optionally including JPEG streams.

  • dump_ifds(ifds) - Serialize directory lists and attached JPEG streams to Exif bytes.

load_ifds_bytes() and load_ifds_file() select the input kind explicitly and accept the same options as load_ifds().

Preservation

This fork aims to preserve supported metadata values through load() and dump(), and unchanged image data and unrelated metadata during EXIF insertion, removal and transplantation. Rebuilt EXIF is not guaranteed to be byte-identical. See preservation goals and limitations.

Example

exif_dict = piexif.load("foo1.jpg")
for ifd in ("0th", "Exif", "GPS", "1st"):
    for tag in exif_dict[ifd]:
        print(piexif.TAGS[ifd][tag]["name"], exif_dict[ifd][tag])

With PIL(Pillow)

from PIL import Image
import piexif

im = Image.open(filename)
exif_dict = piexif.load(im.info["exif"])
# process im and exif_dict...
w, h = im.size
exif_dict["0th"][piexif.ImageIFD.XResolution] = (w, 1)
exif_dict["0th"][piexif.ImageIFD.YResolution] = (h, 1)
exif_bytes = piexif.dump(exif_dict)
im.save(new_file, "jpeg", exif=exif_bytes)

Environment

Tested on Python 2.7, 3.5+ and PyPy3. Piexif would run even on IronPython. Piexif is OS independent and can run on Google App Engine.

License

This software is released under the MIT license, see LICENSE.txt.

Metadata

Release files for piexif-fork 1.1.4a1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for piexif-fork 1.1.4a1
File Size Uploaded
piexif_fork-1.1.4a1.tar.gz 3.2 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for piexif-fork 1.1.4a1
File Interpreter ABI Platform
piexif_fork-1.1.4a1-py3-none-any.whl Python 3 none any Details

Total release size: 3.2 MB

Release files / piexif_fork-1.1.4a1.tar.gz

Download URL piexif_fork-1.1.4a1.tar.gz
Size 3.2 MB
Tags Source
SHA-256 checksum
How to use checksums
4e5745e4ae21457f25b919680505fa0dd1a22eee4bca4b39f290f949dcbce43f
BLAKE2b-256 checksum
How to use checksums
5fd1f04072ba166e8961241e8b82671f9c05bd0e5c612257fabdab2bafc08f6b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 19, 2026.

Transparency log

Release files / piexif_fork-1.1.4a1-py3-none-any.whl

Download URL piexif_fork-1.1.4a1-py3-none-any.whl
Size 47.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0b7fc5095ab548edb9399003cb2bc091141d759e5dfded47986f931f3e8266e0
BLAKE2b-256 checksum
How to use checksums
2587d40d3e39939c85cc3cd86bc08e810f56dff3ac0d4725c71fea88dbd892fe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 19, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.1.4a1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page