Extracting raw EXIF data from image

Started by ExploreCams, February 18, 2021, 08:32:59 AM

Previous topic - Next topic

ExploreCams

Hello,

I would like to extract raw exif data from image to a file (to save space) and later read it with an exiftool. Is this possible?

Thanks.
https://explorecams.com - collection of sample images captured with various camera models & lenses

Phil Harvey

Hi Linas,

This is possible in many ways.  Read here for some ways to create a metadata sidecar file.  Specifically, I'm thinking you may want to use an EXIF sidecar file.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

ExploreCams

Nice, thanks.

p.s. Just to clarify, do all of these commands output the same data?

exiftool -exif -b SRCFILE > out.exif
exiftool -tagsfromfile SRCFILE -exif out.exif
exiftool -o out.exif -exif SRCFILE
https://explorecams.com - collection of sample images captured with various camera models & lenses

ExploreCams

Hm, but if I do extract EXIF sidecar file. Do I miss all other additional formats? (e.g. XMP, IPTC)

I would like to extract any raw metadata except an actual image. The purpose of this is to have small footprints of images, so I could easily re-read these when new ExifTool comes out. I have over 20 million images.
https://explorecams.com - collection of sample images captured with various camera models & lenses

StarGeek

Quote from: Linas Pašviestis on February 18, 2021, 12:07:58 PM
Hm, but if I do extract EXIF sidecar file. Do I miss all other additional formats? (e.g. XMP, IPTC)

Yes.  XMP can be copied to a XMP sidecar but IPTC would be left out.  There is an XMP equivalent for most IPTC data.

QuoteI would like to extract any raw metadata except an actual image. The purpose of this is to have small footprints of images, so I could easily re-read these when new ExifTool comes out.

Take a look at exiftool's own MIE file in the link Phil gave above.  You could copy EXIF, IPTC, and XMP, as well as the ICC_Profile and MakerNotes.

QuoteI have over 20 million images.

Ok, I thought I had a significant collection of images I've collected from the net and photos I've taken and family photos I've scanned, somewhere between 1-2 million, but you've taken it to a whole other level.  Consider me impressed.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

ExploreCams

Quote from: StarGeek on February 18, 2021, 01:05:14 PM
Take a look at exiftool's own MIE file in the link Phil gave above.  You could copy EXIF, IPTC, and XMP, as well as the ICC_Profile and MakerNotes.

So if I understand it correctly the following comand will extract all available metadata from an image into a file?
exiftool -tagsfromfile a.jpg -all:all -icc_profile a.mie

Quote from: StarGeek on February 18, 2021, 01:05:14 PM
Ok, I thought I had a significant collection of images I've collected from the net and photos I've taken and family photos I've scanned, somewhere between 1-2 million, but you've taken it to a whole other level.  Consider me impressed.

I do run a website https://explorecams.com , feel free to donate some of the original photos if you like it. :-)
https://explorecams.com - collection of sample images captured with various camera models & lenses

StarGeek

That won't copy the MakerNotes or any tag that exiftool doesn't know how to write.  Copying the groups as a block should save everything, even stuff that exiftool is unable to write.  And you'll probably want to do it in batch, so try this (I can't remember if copying EXIF will also copy MakerNotes or not)
exiftool -tagsfromfile -o %d%f.mie -EXIF -XMP -IPTC -MakerNotes -icc_profile /path/to/files/

This will create the sidecars in the same directory as the files.  If you want to use a different directory, change the %d to the correct path.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

ExploreCams

Quote from: StarGeek on February 18, 2021, 07:28:30 PM
That won't copy the MakerNotes or any tag that exiftool doesn't know how to write.  Copying the groups as a block should save everything, even stuff that exiftool is unable to write.  And you'll probably want to do it in batch, so try this (I can't remember if copying EXIF will also copy MakerNotes or not)
exiftool -tagsfromfile -o %d%f.mie -EXIF -XMP -IPTC -MakerNotes -icc_profile /path/to/files/

This will create the sidecars in the same directory as the files.  If you want to use a different directory, change the %d to the correct path.

I thought -all:all is the replacement for -exif -xmp -iptc and -makernotes.
https://explorecams.com - collection of sample images captured with various camera models & lenses

Phil Harvey

Quote from: Linas Pašviestis on February 18, 2021, 09:07:36 AM
Just to clarify, do all of these commands output the same data?

exiftool -exif -b SRCFILE > out.exif
exiftool -tagsfromfile SRCFILE -exif out.exif
exiftool -o out.exif -exif SRCFILE

Yes, but they differ in their behaviour if the file already exists.  The first one overwrites out.exif if it already exists, and the other two fail if out.exif exists.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

ExploreCams

Quote from: Phil Harvey on February 19, 2021, 07:55:40 AM
Quote from: Linas Pašviestis on February 18, 2021, 09:07:36 AM
Just to clarify, do all of these commands output the same data?

exiftool -exif -b SRCFILE > out.exif
exiftool -tagsfromfile SRCFILE -exif out.exif
exiftool -o out.exif -exif SRCFILE

Yes, but they differ in their behaviour if the file already exists.  The first one overwrites out.exif if it already exists, and the other two fail if out.exif exists.

- Phil

Phil, would the following command would be the ultimate one to extract every metadata bit from the image? Or I will miss some extra meta formats e.g. MakerNotes, XMP, IPTC?
exiftool -tagsfromfile a.jpg -all:all -icc_profile a.mie
https://explorecams.com - collection of sample images captured with various camera models & lenses

Phil Harvey

That command will get most of the tags that ExifTool can write.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

StarGeek

The key point being "can write".  MakerNotes for example, cannot be copied individually.  It must be copied as a block (see last paragraph of FAQ #8).

Another example would be any tag that requires a config file to write, such as the Pix4d tags.  Without the config file, those tags would not be copied.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

Phil Harvey

But that command should copy the MakerNotes as a block for most common makes.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

ExploreCams

Quote from: Phil Harvey on February 19, 2021, 09:19:55 AM
That command will get most of the tags that ExifTool can write.

Okay, so lets say my goal is to store a raw metadata file without the actual image, so I could easily re-run / update the output when I upgrade exiftool. The most important bit of information is identification of Lens Id to me and other inconsistances in EXIF (if these even happen between versions). Should this command 100% completely cover my goal?


Sorry, for asking this again and again, as it would take a bit of time to extract things from 20M+ images and I want to be 100% certain. :-)
https://explorecams.com - collection of sample images captured with various camera models & lenses

Phil Harvey

I can't answer this 100%.  It depends on the models of cameras used to generate the images, and the softwares used to process them afterwards.  Some cameras may not be supported, and some software may make a huge mess of the metadata.  In both of these cases you may lose some information.  I suggest trying this out on a cross-section of representative samples to satisfy yourself that it is doing what you want for your files.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).