To simplify exif manipulations with python. Writing, reading, and more...
Project description
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 and run:
$ python setup.py install
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file piexif-1.0.1.zip
.
File metadata
- Download URL: piexif-1.0.1.zip
- Upload date:
- Size: 653.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5aeab195289d7c774b2d757875053d420afb8b7c35de91838dec0334342abd94 |
|
MD5 | bceb0a24b914770a779edac6634f8ae4 |
|
BLAKE2b-256 | f9197da84fd8c5ed757845e7fc568b05d0d53e8c657e368d06d3ee636ad015ca |
Provenance
File details
Details for the file piexif-1.0.1-py2.py3-none-any.whl
.
File metadata
- Download URL: piexif-1.0.1-py2.py3-none-any.whl
- Upload date:
- Size: 16.0 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bbcdfb25e972a66cca41583e6f3321ba95c984bfbff326ebc4c5d7ad9171a069 |
|
MD5 | eddfc4bd77dcee3770fd30e66c04f4ed |
|
BLAKE2b-256 | 390c5c8ea442e42a516737b64a89b78508769dced5c64e5178711cf15b7faa57 |