Guide to GPS metadata in photos (part 2). How to change GPS and other metadata in a photo.

27 April 2023 16 minutes Author: Cyber Witcher

Methods of determining the coordinates of any place

There are certain cases when you need exact coordinates for a specific location. In today’s world, this can be done very quickly and without using any special knowledge or skills. You can easily find out the geographic coordinates of any point on the world map. To do this, you need to click with the left button of the computer mouse on the place you have chosen on the geographical map of the world and you will find out the exact coordinates of this place (point) on the world map. One of the nice things about your photos is that they contain location data, which helps you arrange them in albums based on where they were taken, since you can group all the photos together.

But the bad thing here is that the geolocation is attached to the photo, so when you share it with others, they can tell exactly where it was taken! And privacy should be above all else! Therefore, there are cases when, on the contrary, you need to hide such data, change it or even slightly manipulate it. And this, too, it turns out, is quite easy to do, if you study this issue a little. There are a number of programs and tools that will help you easily change or even delete data. We will definitely consider all this in the article and you will learn how to delete only certain tags in the metadata, or how to change the GPS coordinates on a photo. Let’s start!

Take a look at this image’s metadata:

https://hackware.ru/files/Kremlin.zip

In particular, look at the coordinates, date of shooting, camera, notes. Use geolocation services to compare how different the location shown by them is from the image in the photo.

Пошук координат.

The file is placed in the archive so that you can also evaluate the date of change, which is indicated by the red arrow. After reading this guide, you will be able to joke with those who like to check metadata, as well as with services that automatically indicate the location of the shooting (Instagram, Twitter).

Вилучаємо файл з архіву.

So, how do you find out the coordinates of any place? GPS spoofing requires knowing the geographic coordinates of a desired location. This can be done by opening the map  (https://www.google.com/maps), then find the desired location and adjust the view so that it is in the center, zoom in if necessary. Then look at the address bar of the web browser, there will be something like: https://www.google.com/maps/@14.9684368,98.6656482,10.75z. The first two numbers after @, which are separated by commas, are the latitude and longitude.

The name of the metadata tags. Tag groups

If you decide not to just remove the metadata, but to manipulate it, then you need to know more details so that you don’t get stuck because you forgot to tag with duplicate data, causing the metadata to be inconsistent or just give away the real data. To manipulate meta information tags (delete, change, show, exclude selected tags) you need to know their name. Tag names are standardized. Metadata display programs usually do not display the correct tag name. Instead, they usually display the data in a user-friendly way, sometimes even translating it into the user’s language.

Information from the camera.

The tag name from this conclusion can also be used for ExifTool – you need to take the part of the name after the last point. And in Exiv2 you need to use the full name. This method seems simple, but it is NOT ideal because Exiv2 program supports only three groups of tags: Exif, IPTC and XMP. And there are dozens of tag groups (not tags, but GROUPS) — the ExifTool documentation lists the tag groups supported by this program.

The correct tag name can be viewed using Exiv2 if you run it with the “-p a” option:

ExifTool has extensive documentation on tags with their correct name, to see it, run the command:

There are many tag groups, the most popular for .jpg files is Exif. IPTC, XMP, MakerNotes are also common.

You can see to which group the meta-information tag belongs with the Exiv2 program (with the option -p a as shown above – first comes the name of the group, then the name of the subgroup, and then the tag itself).

Also with the help of ExifTool, if you specify the -G option. You can add the -e option to not output composite (false, generated for convenience) tags:

giftool -G -e PHOTO

Tags with -G and -e options

It is important to know that the same information can be duplicated in different tags that refer to different groups. Moreover, tags with similar functions can be in one group. For example, the Exif group has DateTime, DateTimeOriginal, and DateTimeDigitized tags, all related to the creation time. Also in this group there are tags Model and Software – the last tag contains the name of the firmware of the phone and allows you to uniquely identify the model, as well as the first tag, which contains the name of the model.

Examples of time tags.

An example of tags that allow you to define the type and model of a space.

Applications display only the metadata they support. Sometimes meta information cannot be completely removed.

Let’s count how many lines the Exiv2 program outputs:

And now for ExifTool:

This is because Exiv2 only supports three groups of tags: Exif, IPTC and XMP. And the ExifTool program supports almost all possible groups.

Remember that some files do not allow you to completely remove the meta information from them. An example of such files is PDF. Changes to PDF files with ExifTool are reversible (by removing the update with -PDF-update:all=) because the original information is never removed from the file. Therefore, ExifTool alone cannot be used to securely edit PDF metadata.

You also need to be careful with MakerNotes. For example, I was never able to get rid of the MakerNotes timestamp tag with the full MakerNotes remove command, even though all other tags in that group were removed. In the RAW (unprocessed) format, MakerNotes can store important information for further processing of the image, so you need to be careful when deleting this group.

Remove only certain tags in the metadata

We already have all the necessary theoretical part for spoofing the location in photo metadata, but let’s start by looking at other possibilities that are not available in simple metadata cleaning programs. Mat and mat2 programs can clear all metadata at once. But ExifTool allows you to remove certain tags or leave certain tags. For example, you can delete only GPS metadata, leaving all other information intact. Let’s consider several examples. The following methods of removing part of the metadata can be combined with each other (for example, remove GPS and camera model). This can be achieved both by sequential execution of the specified commands, and in one command, collecting in it all the necessary options for removal.

How to remove only GPS metadata

To remove all GPS geotags using ExifTool, use the “-gps:all=” option:

In this case, the original file will be saved, “_original” will be added to its name (after the extension). By the way, the exiv2 command overwrites an existing file without a backup copy.

When using the exiftool command, the new file replaces the original file (although it keeps a backup copy of it), with the -o option you can explicitly specify the location and name of the new file:

To check the GPS metadata after removal, use the command:

How to remove only the creation date and time

To remove timestamps, use the view command:

To check available time and date metadata:

Example of metadata to delete:

Example metadata after deletion:

File are timestamps in the file system. They change as the file changes, but can be set to anything you like.

The file creation time is also saved in MakerNotes. Generally, MakerNotes tags are considered “Permanent” and can be edited, but cannot be created or deleted individually. This avoids many potential problems, including the inevitable compatibility issues with OEM software, which can be very inflexible about the information it expects to find in the manufacturer’s notes. That is, we can remove the creation date from MakerNotes, but only if we remove MakerNotes completely.

To do this, you can use a command like:

Example:

Note: Using this option, I was never able to remove the Time Stamp from MakerNotes in my test image (although all other tags in that group were removed). But you may not have this problem. If necessary, the Time Stamp from MakerNotes could be removed using the following algorithm: 1) copying Exif metadata to a file; 2) complete removal of all metadata from the file (using “-all=” even Time Stamp from MakerNotes was removed); 3) restoring Exif metadata from the file.

How to remove only camera information

Use the view command:

Example:

To check metadata associated with a model:

After applying the cleanup command, the output should be empty during the test.

Example output.

How to delete a note only

To remove only the notes, run the following command:

Command to check a note in metadata:

Change the GPS coordinates in the photo

Changing the shooting location in Geotag

In Geotag, click on the Lat or Long column of the photo for which you want to change the coordinates and edit the coordinates for the selected photo. Note that the decimal point can be either a period or a comma (depending on the OS language). That is, if 55.7520263 and 37.6153107 were rounded to 55 and 37, then enter 55.7520263 and 37.6153107 and vice versa.

When you’re done, right-click on the image and select Save New Locations.

Geotag graphical interface

Changing the shooting location in ExifTool

In ExifTool, the shooting location is changed with the following tags:

  • GPSLatitude – latitude, the sign of the number is unimportant

  • GPSLongitude – longitude, the sign of the number is unimportant

  • GPSLatitudeRef – N or S, meaning north or south

  • GPSLongitudeRef – E or W, ie east or west

It is not necessary to use all tags at once

The general form of the team:

To check, use the command (the -e option is required so that composite tags are not created):

Changing the shooting location in Exiv2

This program accepts coordinates as three rational numbers. Three are degrees, minutes, seconds. Rational means indicate additionally “/1”. The following example sets the latitude to 4 degrees 15 minutes 33 seconds north latitude. The Exif standard specifies that the GPSLatitude tag consists of three rational numbers for degrees, minutes, and seconds of latitude, and GPSLatitudeRef contains either N or S for north or south latitude, respectively.

The longitude is set in a similar way. And after that we have the coordinates we need.

List of tags:

  • Exif.GPSInfo.GPSLatitude

  • Exif.GPSInfo.GPSLatitudeRef

  • Exif.GPSInfo.GPSLongitude

  • Exif.GPSInfo.GPSLongitudeRef

How to change the shooting date in a photo’s metadata

Changing the shooting date in Geotag

In Geotag for pictures you can see:

  • GPS time

  • Offset (time zone)

  • Camera time

Geotag graphical interface.

To change, right-click on the snapshot whose capture time you want to change and select Set Snapshot Time.

We make changes.

Then select the desired date and time, as well as the time zone. But this function worked strangely for me – only “GPS time” changed, I don’t understand how to change “Camera time”.

Not everything worked out.

Changing the shooting date in ExifTool

The tag names I found in my test photo (so it’s quite possible that this is an incomplete list):

  • DateTime

  • DateTimeOriginal

  • DateTimeDigitized

  • ModifyDate

  • CreateDate

  • GPSTimeStamp

  • GPSDateStamp

To change the time tags, first see what date and time tags are present in your snapshot, for example with the following command:

Also, the time stamp may be present in MakerNotes – you cannot change it there, you can only completely delete MakerNotes (option “-MakerNotes: all =”). Don’t forget that in addition to metadata, timestamps are in file properties.

In ExifTool, you can set a new date and time:

Installation example.

You can use “+=” and “-=” to increase or decrease the date and time.

If the data is not possible, for example, at the 29th hour, then it is recorded anyway:

Crust. command will refine the original date/time for all images in the DIRECTORY directory by subtracting one hour and 30 minutes. This is equivalent to “-DateTimeOriginal-=1.5”:

Add 3 hours to the CreateDate and ModifyDate timestamps of the two images.

Changing the shooting date in Exiv2

Name of timestamped tags:

  • Exif.Image.DateTime

  • Exif.Image.DateTimeOriginal

  • Exif.Photo.DateTimeOriginal

  • Exif.Photo.DateTimeDigitized

  • Exif.GPSInfo.GPSTimeStamp

  • Exif.GPSInfo.GPSDateStamp

An example of a command that changes three tags at once:

Change team.

The following options allow you to add and subtract years/month/days/hours/minutes/seconds.

-a TIME

  • Time change, format [-]HH[:MM

-Y YEAR

  • Adjust time by positive or negative number of years.

-O MOON

  • Adjust time by a positive or negative number of months.

-D DAY

  • Adjust the time by a positive or negative number of days.

To make it clear, let’s consider a few examples.

Addition of two years to the date:

A decrease of ten years, an increase of two months and ten days, and a decrease of three hours:

How to change the annotations in the metadata of a photo file

Changing annotations in Geotag

Notes can be changed in the image table. The string with “Description” will be placed in the Exif.Photo.UserComment tag.


If it is an Ascii string (English letters), most programs will be able to display it. You can use letters from national alphabets and they will be correctly stored in UTF8 encoding, but not all simple programs will be able to display it. Tags from other columns of the table are stored in the IPTC metadata group (if it does not exist, it is created). Another tag that is not used in Geotag, but you can set or change in ExifTool and Exiv2: (Area Information): Exif.GPSInfo.GPSAreaInformation. When everything is ready, right-click on the image and select “Save new places” (this option is used for any saving – places, comments, time).

The change is noted in ExifTool

The Exif comment is replaced by the following command:

If you prefer, you can use the above IPTC tags to store notes about geographic locations.

Name of IPTC tags for storing location notes:

  • LocationName

  • Sub-location

  • City

  • Province-State

  • Country-PrimaryLocationCode

  • Country-PrimaryLocationName

Change of notes in Exiv2

The following command sets the Exif comment to an ASCII string:

Example:

Actually “charset=Ascii” can be removed, usually the programs correctly recognize the encoding, especially Ascii. Of course, if you want, you can use IPTC tags to store notes about geographic locations.

Name of IPTC tags for storing location notes:

  • Iptc.Application2.LocationName

  • Iptc.Application2.SubLocation

  • Iptc.Application2.City

  • Iptc.Application2.ProvinceState

  • Iptc.Application2.CountryName

Example:

How to change the camera model in metadata photos

Only the ExifTool program can handle this task.

Use the view command:

To check metadata associated with a model:

How to save metadata to a separate file

You can save all metadata or individual tags to a file. The -TagsFromFile option is used for this:

To save all metadata to a file, run the command:

The following command will copy all the metadata from the snapshot “a.jpg” into the XMP data file. If the XMP data file “out.xmp” already exists, it will be updated with the new information. Otherwise, an XMP data file will be created.

Thus, files containing only metadata can be created (files containing images can be edited, but not created).

To write metadata from an image file, you need to swap the files, that is, the following command will result:

Copy metadata between files

The following examples simply reveal the capabilities of the -TagsFromFile option and the flexibility of the geolocation tool.

Copy the values of all writable tags from src.jpg to dst.jpg, keeping the original tag groups.

Remove all metadata from “dst.jpg” image, then copy EXIF tags from “src.jpg”

Copy ICC_Profile from one image to another.

Copy only EXIF information from one image to another, excluding SubIFD tags.

Copy the title from one image to another and set the new author name.

Copy ISO from one image and comment from another image to target image.

Copy all meta information from “a.jpg” to “b.jpg”, removing all XMP information and image thumbnail from destination.

Processing a large number of photos

You can process a large number of files at once.

This example removes the GPS tags from all JPG images in the current directory, writing the changed images to a new directory.

In this team:

  • . (dot) means all files in the current directory

  • -ext jpg means only process files with jpg extension

  • -o NEW_DIRECTORY specifies the folder to save received new files

Metadata replacement example

All shown actions for deleting and editing metadata can be combined with each other. As an example, I will show how I made the file linked at the beginning of the article. Save the existing metadata to the meta.exif file. This is to completely remove the timestamped MakerNotes – I only succeed with removing all metadata. But I want to keep all the Exif tags so that the resulting metadata set looks more natural, they will have a lot of tags with shooting conditions and other things that are not important to us.

The “-exif:all” option can be added to this command to copy only the Exif metadata.

You can see exactly which tags are present in the file that is the metadata store:

We remove all metadata from the file (due to problems with MakerNotes):

We check:

We restore metadata:

We check:

We set new values for a number of tags:

A group of XMP and MakerNotes appeared (but without a time stamp!), so we delete them with the following command:

We change the time of creation, last modification and access to file properties (for example, they are stored when files are transferred in archives):

We pack in the archive:

Other related articles
Found an error?
If you find an error, take a screenshot and send it to the bot.