Pillow is a Python Imaging Library that provides support for opening, manipulating, and saving many different image file formats. If you want to extract all Exif (Exchangeable image file format) information from an image using Pillow, you can use the following code:
from PIL import Image def extract_exif_info(image_path): try: # Open the image file with Image.open(image_path) as img: # Check if the image has Exif data if hasattr(img, '_getexif'): exif_info = img._getexif() if exif_info is not None: # Print all Exif information for tag, value in exif_info.items(): print(f"Tag: {tag}, Value: {value}") else: print("No Exif information found in the image.") else: print("Exif information is not supported for this image format.") except Exception as e: print(f"An error occurred: {e}") # Example usage: image_path = "path/to/your/image.jpg" extract_exif_info(image_path)
This code defines a function extract_exif_info
that takes the path to an image file as an argument. Inside the function, it opens the image using Pillow’s Image.open
method and checks if the image has Exif data. If Exif data is present, it prints out all the Exif tags and their corresponding values.
Make sure to replace "path/to/your/image.jpg"
with the actual path to your image file.
Note: Keep in mind that not all image formats or images may have Exif information, and the availability of Exif data depends on how the image was created or modified.
Hi codetoday.net,
Ready to unlock the future of AI technology without the burden of monthly fees?
TotalAi offers you seamless access to the most advanced AI tools available, all from one easy-to-use dashboard—no recurring costs involved: https://www.smartdecide.info/totalaife .
What’s inside TotalAi?
✅ ChatGPT 4.0 & ChatGPT 4 – The latest in conversational AI
✅ Gemini Pro – Advanced multi-modal capabilities
✅ DALL·E 3 – Stunning AI-generated images
✅ Leonardo AI – Innovative design and creative solutions
✅ Microsoft Copilot Pro – Boost productivity with AI assistance
✅ Meta Llama 3 – Powerful language models
✅ Stable Diff XL – Enhanced image synthesis
✅ PaLM 2 – Next-level natural language processing
Don’t miss out on this opportunity to streamline your AI experience and save on monthly fees. Get Started with TotalAi Today: https://www.smartdecide.info/totalaife !
Lee Valdes
UNSUBSCRIBE: https://www.smartdecide.info/unsubscribe/?d=codetoday.net
Address: 2465 Bassel Street
Kenner, LA 70062