diff --git a/.gitignore b/.gitignore index 6bd9bde..548533f 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,8 @@ # OS .directory +.DS_Store + # Images *.jpg @@ -30,6 +32,7 @@ MANIFEST # Installer logs pip-log.txt +pip-delete-this-directory.txt # Unit test / coverage reports .coverage @@ -39,20 +42,30 @@ exif-samples* # Translations *.mo -# Mr Developer -.mr.developer.cfg - -# PyCharm +# IDE +.vscode/ .idea - -# Eclipse +.mr.developer.cfg .project .pydevproject .settings -# Misc -*swp +# Temp files +*.swp +*-swp + +# Environments +.env +.venv +.venv* +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ -# Venv -/venv -/.venv +# mypy +.mypy_cache/ +.mypy_cache +.dmypy.json +dmypy.json diff --git a/ChangeLog.rst b/ChangeLog.rst index 424d56c..20292ea 100644 --- a/ChangeLog.rst +++ b/ChangeLog.rst @@ -1,6 +1,14 @@ -********** -Change Log -********** +EXIF.py Change Log +################## + +3.1.0 — 2023-05-?? + * Add DJI makernotes, extract_thumbnail parameter (#168) by Piero Toffanin + * Fix endianess bug while reading DJI makernotes, add Make tag (#169) by Piero Toffanin + * Make CI pass (#178) by Nick Dimitroff + * update pylint and mypy + * fix webp for file conversion by magick (#132) by Marcelo + * Ignore unknown parsers, fix for #160 (#175) by Herbert Poul + * Allow extracting thumbnails with details=False (#170) 3.0.0 — 2022-05-08 * **BREAKING CHANGE:** Add type hints, which removes Python2 compatibility diff --git a/LICENSE.txt b/LICENSE.txt index d87dc3f..7eb9d17 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,6 +1,6 @@ Copyright (c) 2002-2007 Gene Cash -Copyright (c) 2007-2021 Ianaré Sévi and contributors +Copyright (c) 2007-2023 Ianaré Sévi and contributors Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions diff --git a/Makefile b/Makefile index 3072331..d5c8f22 100644 --- a/Makefile +++ b/Makefile @@ -37,6 +37,7 @@ reqs-install: ## Install with all requirements $(PIP_INSTALL) .[dev] samples-download: ## Install sample files used for testing. + rm -fr master.tar.gz exif-samples-master wget https://github.com/ianare/exif-samples/archive/master.tar.gz tar -xzf master.tar.gz diff --git a/README.rst b/README.rst index 30627c5..d7198c8 100644 --- a/README.rst +++ b/README.rst @@ -62,18 +62,19 @@ Python Script .. code-block:: python import exifread + # Open image file for reading (must be in binary mode) - f = open(path_name, 'rb') + with open(file_path, "rb") as file_handle: - # Return Exif tags - tags = exifread.process_file(f) + # Return Exif tags + tags = exifread.process_file(file_handle) *Note:* To use this library in your project as a Git submodule, you should:: from import exifread Returned tags will be a dictionary mapping names of Exif tags to their -values in the file named by path_name. +values in the file named by ``file_path``. You can process the tags as you wish. In particular, you can iterate through all the tags with: .. code-block:: python @@ -119,13 +120,19 @@ Pass the ``-q`` or ``--quick`` command line arguments, or as: .. code-block:: python - tags = exifread.process_file(f, details=False) + tags = exifread.process_file(file_handle, details=False) To process makernotes only, without extracting the thumbnail image (if any): .. code-block:: python - tags = exifread.process_file(f, details=True, extract_thumbnail=False) + tags = exifread.process_file(file_handle, details=True, extract_thumbnail=False) + +To extract the thumbnail image (if any), without processing makernotes: + +.. code-block:: python + + tags = exifread.process_file(file_handle, details=False, extract_thumbnail=True) Stop at a Given Tag =================== @@ -136,7 +143,7 @@ Pass the ``-t TAG`` or ``--stop-tag TAG`` argument, or as: .. code-block:: python - tags = exifread.process_file(f, stop_tag='TAG') + tags = exifread.process_file(file_handle, stop_tag='TAG') where ``TAG`` is a valid tag name, ex ``'DateTimeOriginal'``. @@ -151,7 +158,7 @@ Pass the ``-s`` or ``--strict`` argument, or as: .. code-block:: python - tags = exifread.process_file(f, strict=True) + tags = exifread.process_file(file_handle, strict=True) Usage Example ============= @@ -168,8 +175,9 @@ This example shows how to use the library to correct the orientation of an image def _read_img_and_correct_exif_orientation(path): im = Image.open(path) tags = {} - with open(path, 'rb') as f: - tags = exifread.process_file(f, details=False) + with open(path, "rb") as file_handle: + tags = exifread.process_file(file_handle, details=False) + if "Image Orientation" in tags.keys(): orientation = tags["Image Orientation"] logging.basicConfig(level=logging.DEBUG) @@ -195,9 +203,18 @@ This example shows how to use the library to correct the orientation of an image im = im.transpose(Image.ROTATE_90) return im -Credit -****** -A huge thanks to all the contributors over the years! +License +******* + +Copyright © 2002-2007 Gene Cash + +Copyright © 2007-2023 Ianaré Sévi and contributors + +A **huge** thanks to all the contributors over the years! Originally written by Gene Cash & Thierry Bousch. + +Available as open source under the terms of the **BSD-3-Clause license**. + +See LICENSE.txt file for details. diff --git a/exifread/__init__.py b/exifread/__init__.py index 01ddaa5..98d0b69 100644 --- a/exifread/__init__.py +++ b/exifread/__init__.py @@ -13,7 +13,7 @@ from exifread.jpeg import find_jpeg_exif from exifread.exceptions import InvalidExif, ExifNotFound -__version__ = '3.0.0' +__version__ = '3.1.0' logger = get_logger() diff --git a/setup.py b/setup.py index 5af24fd..07e011e 100644 --- a/setup.py +++ b/setup.py @@ -31,6 +31,9 @@ "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", "Topic :: Utilities", ], extras_require={