Merge pull request #150 from Icelain/master

added image metadata extractor script
This commit is contained in:
Advaita Saha 2022-10-05 21:37:15 +05:30 committed by GitHub
commit 6e0ac3f8e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 30 additions and 0 deletions

View File

@ -0,0 +1,7 @@
# Image Metadata Extractor
A simple script that extracts metadata from images
## Usage
* Dependencies:
Pillow
* Get started using `pip install -r requirements.txt`

View File

@ -0,0 +1 @@
pillow

View File

@ -0,0 +1,22 @@
from PIL import Image
from PIL.ExifTags import TAGS
import sys
arg = sys.argv[1]
if arg == "":
print("Please give a valid image path")
quit()
image = Image.open(arg)
exifdata = image.getexif()
if len(exifdata) <= 0:
print("No metadata found for this image")
quit()
for tag_id in exifdata:
tagname = TAGS.get(tag_id, tag_id)
value = exifdata.get(tag_id)
print(f"{tagname:25}: {value}")