added image metadata extractor script

This commit is contained in:
icelain 2022-10-05 18:44:44 +05:30
parent 618f2fd966
commit 04f5d77cf0
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}")