Skip to main content

To simplify exif manipulations with python. Writing, reading, and more...

Project description

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

There are only just five functions.

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

  • dump(exif_dict) - Get exif as bytes.

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

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

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

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.3, 3.4, 3.5, 3.6 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

piexif-1.1.1.zip (1.0 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

piexif-1.1.1-py2.py3-none-any.whl (21.6 kB view details)

Uploaded Python 2Python 3

File details

Details for the file piexif-1.1.1.zip.

File metadata

  • Download URL: piexif-1.1.1.zip
  • Upload date:
  • Size: 1.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.9.1 pkginfo/1.4.1 requests/2.18.1 setuptools/28.8.0 requests-toolbelt/0.8.0 tqdm/4.15.0 CPython/3.6.1

File hashes

Hashes for piexif-1.1.1.zip
Algorithm Hash digest
SHA256 c996bcd600afaf126ee142e058a8d62059046a217105a9a270ac48457bcc5544
MD5 ef866b945bf20a08f43a74a900214cf8
BLAKE2b-256 1250ee89c5e417e2e61e3074113375d716baf01b1d06ece9402060d8e8d056b1

See more details on using hashes here.

File details

Details for the file piexif-1.1.1-py2.py3-none-any.whl.

File metadata

  • Download URL: piexif-1.1.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 21.6 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.9.1 pkginfo/1.4.1 requests/2.18.1 setuptools/28.8.0 requests-toolbelt/0.8.0 tqdm/4.15.0 CPython/3.6.1

File hashes

Hashes for piexif-1.1.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 c53b7209e26b1cf9312704befe1b02f5b2002b92d9dd1d9a125bc00c50971e8d
MD5 a4910c40fa026f60e87ec7fe38a5fd46
BLAKE2b-256 04cecda7fa37a9eb2f53b7b12c53043b681e5da273b26dabaa06835047b2f62b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page