1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297
|
**********
PyExifTool
**********
.. image:: https://img.shields.io/badge/Docs-latest-blueviolet
:alt: GitHub Pages
:target: http://sylikc.github.io/pyexiftool/
.. HIDE_FROM_PYPI_START
.. image:: https://github.com/sylikc/pyexiftool/actions/workflows/lint-and-test.yml/badge.svg
:alt: GitHub Actions
:target: https://github.com/sylikc/pyexiftool/actions
.. image:: https://img.shields.io/pypi/v/pyexiftool.svg
:target: https://pypi.org/project/PyExifTool/
:alt: PyPI Version
.. HIDE_FROM_PYPI_END
.. image:: https://img.shields.io/pypi/pyversions/pyexiftool.svg
:target: https://pypi.org/project/PyExifTool/
:alt: Supported Python Versions
.. image:: https://pepy.tech/badge/pyexiftool
:target: https://pepy.tech/project/pyexiftool
:alt: Total PyPI Downloads
.. image:: https://static.pepy.tech/personalized-badge/pyexiftool?period=month&units=international_system&left_color=black&right_color=orange&left_text=Downloads%2030d
:target: https://pepy.tech/project/pyexiftool
:alt: PyPI Downloads this month
.. DESCRIPTION_START
.. BLURB_START
PyExifTool is a Python library to communicate with an instance of
`Phil Harvey's ExifTool`_ command-line application.
.. _Phil Harvey's ExifTool: https://exiftool.org/
.. BLURB_END
The library provides the class ``exiftool.ExifTool`` that runs the command-line
tool in batch mode and features methods to send commands to that
program, including methods to extract meta-information from one or
more image files. Since ``exiftool`` is run in batch mode, only a
single instance needs to be launched and can be reused for many
queries. This is much more efficient than launching a separate
process for every single query.
.. DESCRIPTION_END
.. contents::
:depth: 2
:backlinks: none
Example Usage
=============
Simple example: ::
import exiftool
files = ["a.jpg", "b.png", "c.tif"]
with exiftool.ExifToolHelper() as et:
metadata = et.get_metadata(files)
for d in metadata:
print("{:20.20} {:20.20}".format(d["SourceFile"],
d["EXIF:DateTimeOriginal"]))
Refer to documentation for more `Examples and Quick Start Guide`_
.. _`Examples and Quick Start Guide`: http://sylikc.github.io/pyexiftool/examples.html
.. INSTALLATION_START
Getting PyExifTool
==================
PyPI
------------
Easiest: Install a version from the official `PyExifTool PyPI`_
::
python -m pip install -U pyexiftool
.. _PyExifTool PyPI: https://pypi.org/project/PyExifTool/
From Source
------------
#. Check out the source code from the github repository
* ``git clone git://github.com/sylikc/pyexiftool.git``
* Alternatively, you can download a tarball_.
#. Run setup.py to install the module from source
* ``python setup.py install [--user|--prefix=<installation-prefix>]``
.. _tarball: https://github.com/sylikc/pyexiftool/tarball/master
PyExifTool Dependencies
=======================
Python
------
PyExifTool runs on **Python 3.6+**. (If you need Python 2.6 support,
please use version v0.4.x). PyExifTool has been tested on Windows and
Linux, and probably also runs on other Unix-like platforms.
Phil Harvey's exiftool
----------------------
For PyExifTool to function, ``exiftool`` command-line tool must exist on
the system. If ``exiftool`` is not on the ``PATH``, you can specify the full
pathname to it by using ``ExifTool(executable=<full path>)``.
PyExifTool requires a **minimum version of 12.15** (which was the first
production version of exiftool featuring the options to allow exit status
checks used in conjuction with ``-echo3`` and ``-echo4`` parameters).
To check your ``exiftool`` version:
::
exiftool -ver
Windows/Mac
^^^^^^^^^^^
Windows/Mac users can download the latest version of exiftool:
::
https://exiftool.org
Linux
^^^^^
Most current Linux distributions have a package which will install ``exiftool``.
Unfortunately, some do not have the minimum required version, in which case you
will have to `build from source`_.
* Ubuntu
::
sudo apt install libimage-exiftool-perl
* CentOS/RHEL
::
yum install perl-Image-ExifTool
.. _build from source: https://exiftool.org/install.html#Unix
.. INSTALLATION_END
Documentation
=============
The current documentation is available at `sylikc.github.io`_.
::
http://sylikc.github.io/pyexiftool/
.. _sylikc.github.io: http://sylikc.github.io/pyexiftool/
Package Structure
-----------------
.. DESIGN_INFO_START
PyExifTool was designed with flexibility and extensibility in mind. The library consists of a few classes, each with increasingly more features.
The base ``ExifTool`` class contains the core functionality exposed in the most rudimentary way, and each successive class inherits and adds functionality.
.. DESIGN_INFO_END
.. DESIGN_CLASS_START
* ``exiftool.ExifTool`` is the base class with core logic to interface with PH's ExifTool process.
It contains only the core features with no extra fluff.
The main methods provided are ``execute()`` and ``execute_json()`` which allows direct interaction with the underlying exiftool process.
* The API is considered stable and should not change much with future releases.
* ``exiftool.ExifToolHelper`` exposes some of the most commonly used functionality. It overloads
some inherited functions to turn common errors into warnings and adds logic to make
``exiftool.ExifTool`` easier to use.
For example, ``ExifToolHelper`` provides wrapper functions to get metadata, and auto-starts the exiftool instance if it's not running (instead of raising an Exception).
``ExifToolHelper`` demonstrates how to extend ``ExifTool`` to your liking if your project demands customizations not directly provided by ``ExifTool``.
* More methods may be added and/or slight API tweaks may occur with future releases.
* ``exiftool.ExifToolAlpha`` further extends the ``ExifToolHelper`` and includes some community-contributed not-very-well-tested methods.
These methods were formerly added ad-hoc by various community contributors, but no longer stand up to the rigor of the current design.
``ExifToolAlpha`` is *not* up to the rigorous testing standard of both
``ExifTool`` or ``ExifToolHelper``. There may be old, buggy, or defunct code.
* This is the least polished of the classes and functionality/API may be changed/added/removed on any release.
* **NOTE: The methods exposed may be changed/removed at any time.**
* If you are using any of these methods in your project, please `Submit an Issue`_ to start a discussion on making those functions more robust, and making their way into ``ExifToolHelper``.
(Think of ``ExifToolAlpha`` as ideas on how to extend ``ExifTool``, where new functionality which may one day make it into the ``ExifToolHelper`` class.)
.. _Submit an Issue: https://github.com/sylikc/pyexiftool/issues
.. DESIGN_CLASS_END
Brief History
=============
.. HISTORY_START
PyExifTool was originally developed by `Sven Marnach`_ in 2012 to answer a
stackoverflow question `Call exiftool from a python script?`_. Over time,
Sven refined the code, added tests, documentation, and a slew of improvements.
While PyExifTool gained popularity, Sven `never intended to maintain it`_ as
an active project. The `original repository`_ was last updated in 2014.
Over the years, numerous issues were filed and several PRs were opened on the
stagnant repository. In early 2019, `Martin Čarnogurský`_ created a
`PyPI release`_ from the 2014 code with some minor updates. Coincidentally in
mid 2019, `Kevin M (sylikc)`_ forked the original repository and started merging
the PR and issues which were reported on Sven's issues/PR page.
In late 2019 and early 2020 there was a discussion started to
`Provide visibility for an active fork`_. There was a conversation to
transfer ownership of the original repository, have a coordinated plan to
communicate to PyExifTool users, amongst other things, but it never materialized.
Kevin M (sylikc) made the first release to the PyPI repository in early 2021.
At the same time, discussions were started, revolving around
`Deprecating Python 2.x compatibility`_ and `refactoring the code and classes`_.
The latest version is the result of all of those discussions, designs,
and development. Special thanks to the community contributions, especially
`Jan Philip Göpfert`_, `Seth P`_, and `Kolen Cheung`_.
.. _Sven Marnach: https://github.com/smarnach/pyexiftool
.. _Call exiftool from a python script?: https://stackoverflow.com/questions/10075115/call-exiftool-from-a-python-script/10075210#10075210
.. _never intended to maintain it: https://github.com/smarnach/pyexiftool/pull/31#issuecomment-569238073
.. _original repository: https://github.com/smarnach/pyexiftool
.. _Martin Čarnogurský: https://github.com/RootLUG
.. _PyPI release: https://pypi.org/project/PyExifTool/0.1.1/#history
.. _Kevin M (sylikc): https://github.com/sylikc
.. _Provide visibility for an active fork: https://github.com/smarnach/pyexiftool/pull/31
.. _Deprecating Python 2.x compatibility: https://github.com/sylikc/pyexiftool/discussions/9
.. _refactoring the code and classes: https://github.com/sylikc/pyexiftool/discussions/10
.. _Jan Philip Göpfert: https://github.com/jangop
.. _Seth P: https://github.com/csparker247
.. _Kolen Cheung: https://github.com/ickc
.. HISTORY_END
Licence
=======
.. LICENSE_START
PyExifTool is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the licence, or
(at your option) any later version, or the BSD licence.
PyExifTool is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See ``LICENSE`` for more details.
.. LICENSE_END
|