Giter Site home page Giter Site logo

piexif's Introduction

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

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.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.

piexif's People

Contributors

brian-armstrong-discord avatar cfinnberg avatar hmatoba avatar hugovk avatar jaddison avatar mpenkov avatar ndbroadbent avatar radarhere avatar savenr avatar smurfix avatar toaarnio avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.