Python Script to Read & Extract All EXIF Metadata of PNG & JPG Image File in Terminal
311 views
Jun 3, 2025
Buy the full source code of application here:
View Video Transcript
0:00
uh hello guys uh welcome to this video
0:02
so in this video I will show you how to
0:04
read the XF metadata of a actual image
0:08
file when the image was taken what
0:10
camera took the image you can basically
0:12
read all this information using a Python
0:14
script so I have this image available
0:17
right here you can see it's a 2 jpg file
0:19
here
0:21
so so if I want to get some information
0:24
regarding this image I will run this
0:27
Python script you will see it will
0:29
actually read all the XF metadata of
0:32
this image it will show you the time of
0:35
this image which is
0:37
200 1 year you will see the time period
0:40
it will show you which camera taken this
0:42
image camera model as well so all this
0:44
information it will be captured so for
0:47
this we just need to use a third party
0:50
Python package here which
0:52
is you just need to say pip install XF
0:56
read this is the package here XF read so
0:59
simply install this i've already
1:01
installed it so now to actually do this
1:04
it's very
1:07
easy
1:09
so now first of all you
1:13
actually require this package so we
1:16
simply require it by the import
1:18
statement XF
1:20
read and then we actually open the image
1:23
by using the open function so we simply
1:25
say 2.jpg
1:26
jpg and we just need to read this in the
1:29
binary mode so we'll say and as image
1:33
file so we are reading this image here
1:35
you can see we are opening this image
1:37
and
1:38
then we will use this package x read and
1:43
it actually contains this function which
1:45
is
1:47
process file so here we can actually
1:50
pass inside this function process file
1:53
we can pass this image which is this
1:56
image
2:01
file so after passing this we actually
2:05
get all this information inside this tax
2:07
so we can display this tags right here
2:10
by simply looping through all the tags
2:13
here tax dot
2:16
keys and we can actually print out
2:19
everything from
2:26
this so we are basically printing all
2:29
this metadata information so if I run
2:31
this Python script
2:34
now you will see it will print out
2:38
everything you can see all this
2:40
information which is sequence number
2:42
image size so it will actually image m
2:45
which is scannon digital image
2:48
orientation horizontal
2:50
resolution date of the image centered
2:54
compression all this metadata is printed
2:57
out you will see accept data so in this
2:59
way you can print out everything and if
3:02
you want to specifically print out some
3:04
kind of information then you can
3:06
actually specifically target information
3:09
if you only need certain kind of
3:12
information then you can add some if
3:15
condition right
3:17
here so we only need the date time we
3:20
only need the camera which taken this
3:23
image and we only need the camera model
3:26
so if you run this now it will only
3:28
extract the useful information which
3:30
will be the date of this image the
3:33
camera and the camera models so in this
3:35
way guys you can read this active data
3:38
metadata of any image using this package
3:40
active read in Python uh thank you very
3:43
much for watching this video and also
3:46
check out my website freemediattools.com
3:49
uh which contains thousands of tools
#Scripting Languages
#Software