In this article, we’ll
discover various methods to
read, write and
manipulate the meta-data information recorded in a variety of file types. In order to achieve this, we’ll be using a tool known as “ExifTool”.
EXIF is an acronym
for Exchangeable Image File Format
and it is a standard for the inclusion of metadata in certain file types.
Table
of Content
Introduction
Installation
To extract the entire metadata of a file, we just need to execute the given below command:
exiftool
Extract the
Common Meta-Data Information
Now execute the given below command which will provide us the output of the most common Exif tags of the image file.
Extract the Specific
Meta-Data Information
We can list a particular meta information of our image file by simply executing the command given:
Extract GPS
Co-ordinates
The photographs we capture using our smartphones or camera have GPS coordinates embedded as metadata in the image files. To obtain this, we just need to fire the command given below:
Extract Thumbnail Image
Thumbnails are the original preview images basically compressed. These are just created to open the original images more quickly and act as place holders to them. In order to extract these thumbnail images, we just need to execute the following command:
exiftool -ThumbnailImage (filename) > (Outout filename)
Here we can see that the thumbnail.jpg file is extracted from the test.jpg image.
Extract metadata using specific keywords
The following command will assist us to extract the metadata information associated with some specific keywords.
exiftool “-*keyword*”
From the below picture, we can see that our fired command displays all tags with names containing the word "Image" from the file.
ExifTool’s Verbose Mode
Verbose mode generates extended information i.e. when we add [-v] to the exiftool command it will display us the comprehensive data about the process that it is performing.
exiftool -v
Writing the Meta-Data
Removing Meta-Data Information
We have only extracted or manipulated the exifdata so far, but what if we want to remove or delete all the metadata from an image file. Just execute the following below command, let's see how this works:
exiftool -all=
It shows 1 image files uploaded. The "test.jpg" exifdata has been removed effectively. Although let's attempt to extract the metadata from "test.jpg" again, hence we’re just getting the basic information of the image and the rest is deleted.
Saving outputs in Multiple Format
exiftool -h (filename) > (output.html)
Here, we can see test.html file is generated. Although we just need to open it to check our exifdata output in any of our browsers.
Extracting ExifData from a Video file
ExifTool not only extract metadata from the jpg file format but can also read and write in a variety of files. To know more click here.
We will now extract the entire meta-data information from a mp4 video file. To extract this, we will run the basic exiftool’s command i.e.
exiftool
Conclusion
Table
of Content
·
Introduction
to ExifTool
·
Installation
·
Usage
of exiftool
o
Extract
the Common Meta-Data Information
o
Extract
the Specific Meta-Data Information
o
Extract
GPS Co-ordinates
o
Extract
Thumbnail Image
o
Extract
metadata using specific keywords
·
ExifTool’s
Verbose Mode
·
Writing
the Meta-Data Information
·
Removing
Meta-Data Information
·
Saving
outputs
o
In
HTML file
o
In Text File
·
Extracting
ExifData from a Video file
Introduction
ExifTool is developed by
Phil Harvey. It is a platform-independent Perl library coupled with a full-featured
command-line implementation for reading, writing and manipulating the metadata
across a broad range of files, particularly the JPEG images. This metadata may comprise a bunch of
information such as the camera make, file type, permissions, file
size etc., though it further offers more details about the photograph, like the
exposure, the shutter speed and whether the flash fired or not. ExifTool probably gives us the simplest way to extract metadata
from files, as it is free and an open-source program.
Installation
Exiftool is quite easy to
deploy. It's just about hitting our Linux terminal and cloning the tool from
GitHub.
In addition, we need to
install the necessary package for it.
sudo apt-get install
libimage-exiftool-perl
So, we've mounted the tool
in our system. Let’s take a closer look at it.
Usage of ExiftoolTo extract the entire metadata of a file, we just need to execute the given below command:
exiftool
From the below image, you
can now notice that we’ve got all the information drawn from our image file
from the very basic to advance.
However, if we need to capture the ids along
with exif tags in the Hexa-Decimal format, though we need to run the following
command:
exiftool -H
From the below image, we can see that there is
a lot of information stored within these Exif tags.
Now execute the given below command which will provide us the output of the most common Exif tags of the image file.
exiftool –common
We can list a particular meta information of our image file by simply executing the command given:
exiftool
-tagname -tagname
From the below image, we get our desired output displayed along
with their respected tagnames in a list type format.The photographs we capture using our smartphones or camera have GPS coordinates embedded as metadata in the image files. To obtain this, we just need to fire the command given below:
exiftool
| grep GPS
Here we got the GPS Position, now just copy and paste this
complete coordinate information over Google Maps and we will get the exact
location of the camera when the picture was taken.Extract Thumbnail Image
Thumbnails are the original preview images basically compressed. These are just created to open the original images more quickly and act as place holders to them. In order to extract these thumbnail images, we just need to execute the following command:
exiftool -ThumbnailImage (filename) > (Outout filename)
Here we can see that the thumbnail.jpg file is extracted from the test.jpg image.
Extract metadata using specific keywords
The following command will assist us to extract the metadata information associated with some specific keywords.
exiftool “-*keyword*”
From the below picture, we can see that our fired command displays all tags with names containing the word "Image" from the file.
ExifTool’s Verbose Mode
Verbose mode generates extended information i.e. when we add [-v] to the exiftool command it will display us the comprehensive data about the process that it is performing.
exiftool -v
Writing the Meta-Data
ExifTool provide us a great power to write most of the information on
the EXIF tags, that anyone might want to alter, but some tags are protected
because they describe the image's physical characteristics that we can't change
with ExifTool, such as compression.
Also, other tags like the GPS, the MakerNotes, these information can be
edited.
To manipulate the exif data we need to execute the following command:
exiftool -Make=
“HackingArticles”
Here we can see that the information stored in the “Make” tag is
replaced from “OPPO” to “HackingArticles”. While writing the information,
ExifTool’s script automatically preserves the original file by adding "_original
" to the end of file name.We have only extracted or manipulated the exifdata so far, but what if we want to remove or delete all the metadata from an image file. Just execute the following below command, let's see how this works:
exiftool -all=
It shows 1 image files uploaded. The "test.jpg" exifdata has been removed effectively. Although let's attempt to extract the metadata from "test.jpg" again, hence we’re just getting the basic information of the image and the rest is deleted.
Saving outputs in Multiple Format
1. In HTML file
We will save the ExifTool’s output in an HTML file in
order to maintain the records and for better readability. To do this we will
use the parameter “-h” along with the exiftool’s command and save the results
in a file with .html extension.exiftool -h (filename) > (output.html)
Here, we can see test.html file is generated. Although we just need to open it to check our exifdata output in any of our browsers.
2. In Text File
We can even export our
exifdata to a text file similar to the output of the HTML. To achieve this, we
simply need to execute the following commands:
exiftool (filename)
> (outputexif.txt)
Further we can also
monitor our output either by opening it in any of the text editors or by simply
running the command:
cat
ExifTool not only extract metadata from the jpg file format but can also read and write in a variety of files. To know more click here.
We will now extract the entire meta-data information from a mp4 video file. To extract this, we will run the basic exiftool’s command i.e.
exiftool
Conclusion
This was Exiftool's complete usability guide
as a meta-data extractor. It is user-friendly and convenient because of its
simple command-line implementation. It has thus become one of the best tools to
extract meta-data data from a variety of file formats.
0 comments:
Post a Comment