{"id":23691,"library":"exif","title":"exif","description":"A Python library to read and modify image EXIF metadata with a simple, intuitive API. Current version 1.6.1 requires Python >=3.7. Releases are infrequent, but the library is stable and widely used.","status":"active","version":"1.6.1","language":"python","source_language":"en","source_url":"https://github.com/ianare/exif-py","tags":["exif","metadata","image","photos"],"install":[{"cmd":"pip install exif","lang":"bash","label":"Install exif from PyPI"}],"dependencies":[],"imports":[{"note":"exif submodules are not directly importable; use the from syntax.","wrong":"import exif.Image","symbol":"Image","correct":"from exif import Image"}],"quickstart":{"code":"from exif import Image\n\nwith open('image.jpg', 'rb') as f:\n    img = Image(f)\n\nif img.has_exif:\n    print(f\"Make: {img.make}\")\n    print(f\"Model: {img.model}\")\n    print(f\"Date/Time Original: {img.datetime_original}\")\nelse:\n    print(\"No EXIF data found.\")","lang":"python","description":"Open a JPEG file, read EXIF tags, and print common attributes."},"warnings":[{"fix":"Use hasattr() or the tag's 'get' method (e.g., img.get('make', 'Unknown')).","message":"Version 1.0.0 changed from returning None to raising AttributeError when a tag does not exist. Accessing a tag not present in the image will raise an AttributeError, not return None.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Always use open('image.jpg', 'rb') when reading images with exif.","message":"You must open the image file in binary read mode ('rb'), not text mode. Opening in text mode will cause UnicodeDecodeError or corrupt EXIF parsing.","severity":"gotcha","affected_versions":"all"},{"fix":"Open with 'rb+', modify tags, then call img.write() before closing.","message":"Writing EXIF data requires the file to be opened in 'rb+' mode and the image to be seekable. Many users forget to open with write permission or close the file before writing.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use getattr(img, 'make', 'Unknown') or the .get() method: img.get('make').","cause":"The tag 'make' is not present in the EXIF data. The library raises AttributeError for missing tags since v1.0.0.","error":"AttributeError: 'Image' object has no attribute 'make'"},{"fix":"Open the file with open('image.jpg', 'rb') (binary read mode).","cause":"The image was opened in text mode instead of binary mode.","error":"UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte"},{"fix":"Open with 'rb+' (read and write binary) and ensure the file is not closed before calling img.write().","cause":"Trying to write EXIF data to a file opened in read-only mode ('rb') or after the file has been closed.","error":"OSError: [Errno 9] Bad file descriptor"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}