[exif] Package
Read and modify image EXIF metadata using Python without any third-party software dependencies. For example, batch process image metadata using a Python script.
Quick Start
Open an image with EXIF metadata using the Python open() built-in function. Ensure the binary mode flag is set. Pass this image file object into the exif.Image class:
>>> from exif import Image
>>> with open('grand_canyon.jpg', 'rb') as image_file:
... my_image = Image(image_file)
...
>>> my_image.has_exif
True
List EXIF attributes using the list_all() method:
>>> my_image.list_all() ['_exif_ifd_pointer', '_gps_ifd_pointer', 'aperture_value', 'brightness_value', 'color_space', 'components_configuration', 'compression', 'datetime', 'datetime_digitized', 'datetime_original', 'exif_version', 'exposure_bias_value', 'exposure_mode', 'exposure_program', 'exposure_time', 'f_number', 'flash', 'flashpix_version', 'focal_length', 'focal_length_in_35mm_film', 'gps_altitude', 'gps_altitude_ref', 'gps_datestamp', 'gps_dest_bearing', 'gps_dest_bearing_ref', 'gps_horizontal_positioning_error', 'gps_img_direction', 'gps_img_direction_ref', 'gps_latitude', 'gps_latitude_ref', 'gps_longitude', 'gps_longitude_ref', 'gps_speed', 'gps_speed_ref', 'gps_timestamp', 'jpeg_interchange_format', 'jpeg_interchange_format_length', 'lens_make', 'lens_model', 'lens_specification', 'make', 'maker_note', 'metering_mode', 'model', 'orientation', 'photographic_sensitivity', 'pixel_x_dimension', 'pixel_y_dimension', 'resolution_unit', 'scene_capture_type', 'scene_type', 'sensing_method', 'shutter_speed_value', 'software', 'subject_area', 'subsec_time_digitized', 'subsec_time_original', 'white_balance', 'x_resolution', 'y_and_c_positioning', 'y_resolution']
Access EXIF metadata tags using Python attribute notation:
>>> # Read tags with Python "get" notation. >>> my_image.gps_latitude (36.0, 3.0, 11.08) >>> my_image.gps_longitude (112.0, 5.0, 4.18) >>> my_image.model 'iPhone 7' >>> >>> # Modify tags with Python "set" notation. >>> my_image.make = "Python" >>> >>> # Delete tags with Python "del" notation. >>> del my_image.gps_latitude >>> del my_image.gps_longitude >>> >>> # Add new tags with Python "set" notation. >>> from exif import LightSource >>> my_image.light_source = LightSource.DAYLIGHT
Write the image with modified EXIF metadata to an image file using open() in binary write mode:
>>> with open('modified_image.jpg', 'wb') as new_image_file:
... new_image_file.write(my_image.get_file())
...
Refer to the usage page for information and examples of alternative ways to access EXIF tags (e.g. with index/item syntax or with methods).
Metadata
Release files for exif 1.6.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| exif-1.6.1.tar.gz | 24.1 kB | Without provenance | Details for exif-1.6.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| exif-1.6.1-py3-none-any.whl | Python 3 | none | any | Details for exif-1.6.1-py3-none-any.whl |
Total release size: 54.5 kB
Release files / exif-1.6.1.tar.gz
| Download URL | exif-1.6.1.tar.gz |
|---|---|
| Size | 24.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
763599b89b9b67495713060a703f32d1874abf8f0628c9d77711c2c06a5f44c8
|
|
BLAKE2b-256 checksum How to use checksums |
522134c46fbda54648afdcc66f0eec0ac91675361017abcdcdd23bd88fa74cc5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.9.21
|
Release files / exif-1.6.1-py3-none-any.whl
| Download URL | exif-1.6.1-py3-none-any.whl |
|---|---|
| Size | 30.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2879830e2d8f0e5f1503110736bceb83a1e9c2121b32c23208c04284be5afbec
|
|
BLAKE2b-256 checksum How to use checksums |
6707a47a78be02b0a2d273358312f3e2eecc4981d4604f8a6e6b8ef27c1e9c2d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.9.21
|
Security for exif 1.6.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.