Skip to main content

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

Project description

Build Status Coverage Status docs

This is a renamed project from Pyxif. 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 to save with JPEG.

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

  • remove(filename) - Remove exif from JPEG.

  • 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, pypy, and pypy3. Piexif would run even on IronPython. Piexif is OS independent and can run on GoogleAppEngine.

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.0.2.zip (654.3 kB view details)

Uploaded Source

Built Distribution

piexif-1.0.2-py2.py3-none-any.whl (20.9 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file piexif-1.0.2.zip.

File metadata

  • Download URL: piexif-1.0.2.zip
  • Upload date:
  • Size: 654.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for piexif-1.0.2.zip
Algorithm Hash digest
SHA256 9b6dc2ead5742509140e9870ae608b603620c5c2256d62d9123375aa4227ef86
MD5 11d5bb134a0469849a325192a62fc510
BLAKE2b-256 d55b18e1a2dcd1646dc2ad8909e225bd50ae4a4b890c9f7700998dc3149d46b9

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for piexif-1.0.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 b80ecbb4bdfe2b1acbdbd10908813d5552f2158dcf44a39a9bf9a12a16a3010d
MD5 9ccddcad8e22a25f538eb6ab74677343
BLAKE2b-256 2ab0c97e5532427bb5975594de6ad2b5507ad342050b83fd333cbb823597cab3

See more details on using hashes here.

Provenance

Supported by

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