If you are uploading a picture to a public website, it would be wise to scrub any exif properties - especially if there are GPS exif properties. You can do this with the following command:
exiftool -all= picture.jpg
If you are in a directory with many pictures that you want to scrub the exif data from, you can use a wildcard to process them all:
exiftool -all= *.jpg
You can quickly figure out if a picture is missing a particular exif property by running the following command. In this example, I want to see if my picture has the DateTimeOriginal exif property set:
exiftool -filename -r -if '(not $datetimeoriginal)' /path/to/picture.jpg
If you have a folder of pictures to check, or even a folder contaning even more folders of pictures, you can simply replace /path/to/picture.jpg with /path/to/picture/directory/:
exiftool -filename -r -if '(not $datetimeoriginal)' /path/to/picture/directory/
The picture does not have the DateTimeOriginal exif property if its file name is returned.
Ryan M. provides more insight into finding and fixing images with no exif dates.
If your picture was taken on June 29, 2007 at 1:38:55 PM, you can add the CreateDate exif property to your picture with the following command:
exiftool -createdate="2007:06:19 13:38:55" /path/to/picture.jpg
I had a situation where many of my pictures did not have the CreateDate exif property but they did have the DateTimeOriginal exif property. I wanted the CreateDate exif property to have the same value as the DateTimeOriginal exif property. ExifTool’s if functionality makes this easy to fix:
exiftool '-createdate<datetimeoriginal' -r -if '(not $createdate and $datetimeoriginal)' /path/to/picture/directory/
ExifTool will always copy the original picture and then make its modifications. If you want it to overwrite the original picture, add -overwrite_original_in_place
to the exiftool command line.