Skip to content

Commit 353ed9b

Browse files
committed
update image metadata extractor tutorial
1 parent 33bad0f commit 353ed9b

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

ethical-hacking/image-metadata-extractor/image_metadata_extractor.py

+13-10
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,18 @@
88
# read the image data using PIL
99
image = Image.open(imagename)
1010

11-
#extract other metadata
12-
info_dict={"Filename":image.filename,
13-
"Image Size":image.size,
14-
"Image Height":image.height,
15-
"Image Width":image.width,
16-
"Image Format":image.format,
17-
"Image Mode":image.mode,
18-
"Image is Animated": getattr(image, "is_animated", False),
19-
"Frames in Image":getattr(image, "n_frames", 1)
20-
}
11+
# extract other basic metadata
12+
info_dict = {
13+
"Filename": image.filename,
14+
"Image Size": image.size,
15+
"Image Height": image.height,
16+
"Image Width": image.width,
17+
"Image Format": image.format,
18+
"Image Mode": image.mode,
19+
"Image is Animated": getattr(image, "is_animated", False),
20+
"Frames in Image": getattr(image, "n_frames", 1)
21+
}
22+
2123
for label,value in info_dict.items():
2224
print(f"{label:25}: {value}")
2325

@@ -33,3 +35,4 @@
3335
if isinstance(data, bytes):
3436
data = data.decode()
3537
print(f"{tag:25}: {data}")
38+

0 commit comments

Comments
 (0)