How to make a photo have the exact same metadata as another one?

Started by spippiy, September 17, 2024, 08:34:45 AM

Previous topic - Next topic

spippiy

I just started using Exiftool, I read some documentation but I want to make sure I'm doing things exactly right.
My goal is to make a photo (photo1.jpg) have the exact same metadata as another one (photo2.jpg), so that, upon inspection, it appears as though both photos were taken by the same device, at the same time, at the same place,.. Additionally, I want to ensure that it is not possible to tell that the metadata have been modified.

The formats I am mainly interested are jpg and png.
I ask you if the commands I use are correct or I could improve them:

1) First of all, to remove all the metadata from photo1 I use the following command:
exiftool -all="" photo1.jpg
Is this correct?
I also tried using as written in the FAQ
exiftool -ext jpg -all= --icc_profile:all -tagsfromfile @ -colorspacetags photo1.jpg
but a lot of data (mainly ICC-header and ICC_Profile) weren't removed.


2) Then, to copy all the metadata from photo2 to photo1 I use the following command:
exiftool -tagsfromfile photo2.jpg -all:all photo1.jpg
I have noticed that using this command, the ICC-header and ICC_Profile data aren't copied.
Is there a command that allows to copy also them?


3) To see all the metadata of an image I use the following command:
exiftool -ee3 -U -G3:1 -api requestall=3 -api largefilesupport photo1.jpg
By using this command I can see all the metadata of an image or just all the metadata that Exiftool is able to show?

Thank you

wywh


StarGeek

Quote from: spippiy on September 17, 2024, 08:34:45 AMMy goal is to make a photo (photo1.jpg) have the exact same metadata as another one (photo2.jpg), so that, upon inspection, it appears as though both photos were taken by the same device, at the same time, at the same place,.. Additionally, I want to ensure that it is not possible to tell that the metadata have been modified.

As @WYWH says, the only way to be "undetectable" would be to have an intricate knowledge of the file format and the metadata formats and use a hex editor. Even copying the metadata as a block with exiftool will probably leave some fingerprint if an expert compared the edited data with an original file. At the very least, I suspect the ordering of the data would change.

Also, if the image data itself was edited with something like Photoshop, then it is impossible for it not to be known as edited. This is because different source codes will write JPEGs in different ways. The original LibJpeg code will format the interenals one way. Adobe's code has optimized the code better and will write the JPEGs differently. Camera's will have a very loose way of writing the image, as speed is more important than having the smallest file size.

You can use exiftool to list the JPEGDigest tag, which isn't extracted by default as it takes more processing power to computer.

Some examples
C:\>exiftool -G1 -a -s -JPEGDigest y:/!temp/SBP007276v.jpg y:/!temp/Image-001.jpg y:/!temp/BlankTestImage.jpg y:/!temp/Canon_EOS_100D.jpg
======== y:/!temp/SBP007276v.jpg
[File]          JPEGDigest                      : Adobe Photoshop, Quality 10
======== y:/!temp/Image-001.jpg
[File]          JPEGDigest                      : Unknown (bb4cc206e4170202b02ef95f58109740:111111)
======== y:/!temp/BlankTestImage.jpg
[File]          JPEGDigest                      : Independent JPEG Group library (used by many applications), Quality 95
======== y:/!temp/Canon_EOS_100D.jpg
[File]          JPEGDigest                      : Canon EOS 1DmkIII/5DmkII/40D/1000D, Fine

Quote1) First of all, to remove all the metadata from photo1 I use the following command:
exiftool -all="" photo1.jpg
Is this correct?

That will remove nearly all metadata from a JPEG. It won't remove the Adobe APP14 block, but that isn't going to exist unless the file was edited in the first place. It's usually not recommended to remove this as it can severely affect the colors of the image, but it can be done with
-Adobe:All=

QuoteI also tried using as written in the FAQ
exiftool -ext jpg -all= --icc_profile:all -tagsfromfile @ -colorspacetags photo1.jpg
but a lot of data (mainly ICC-header and ICC_Profile) weren't removed.

The color data wasn't removed because this command specifically excludes removing the ICC_Profile and copies other color data back into the file. The two leading dashes in
--icc_profile:all
exclude it from -All=. See the --TAG option.

-tagsfromfile @ -colorspacetags
is used to copy several color related tags back into the file. The exact tags saved are listed on the Shortcuts tags page under the notes for ColorSpaceTags.

Quote2) Then, to copy all the metadata from photo2 to photo1 I use the following command:
exiftool -tagsfromfile photo2.jpg -all:all photo1.jpg
I have noticed that using this command, the ICC-header and ICC_Profile data aren't copied.
Is there a command that allows to copy also them?

The profile isn't copied by default because it is marked as Unsafe to copy. This is because it affects the colors of an image and if you copy one to a completely different image, the second image will have its colors changed in unexpected ways. Adding -ColorSpaceTags after -All:All will copy the ICC_Profile and other color tags. Adding -Unsafe as will copy another set of common tags that are considered unsafe to copy (see the above Shortcuts tags page for more details).


Quote3) To see all the metadata of an image I use the following command:
exiftool -ee3 -U -G3:1 -api requestall=3 -api largefilesupport photo1.jpg
By using this command I can see all the metadata of an image or just all the metadata that Exiftool is able to show?

Barring some extreme trickiness, then it will most likely extract all the data or show an error if there's something weird. You can never say 100%, because there are things like steganography which can be used to hide data in a file. But at that point you are better off looking at the actual file structure with the -v3 (-verbose3) option or using a steganography program because such data would be in the image data itself and exiftool can't read that.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

spippiy

Thank you for the great answer, you have been very clear. I have a few more questions.

Quote from: StarGeek on September 17, 2024, 11:10:43 AMEven copying the metadata as a block with exiftool will probably leave some fingerprint
How can you copy as a block and not as a block?

What is the difference between -all and -all:all?

What @ does?

I read the documentation but I have difficulties understanding. Thank you

StarGeek

Quote from: spippiy on September 18, 2024, 07:10:33 AMHow can you copy as a block and not as a block?

See the last paragraph in FAQ #9, "The tag locations change when I use -tagsfromfile to copy information".

QuoteWhat is the difference between -all and -all:all?

It depends upon how it is used. When deleting tags, i.e. using -All= or -All:All=, they are functionally identical. When used to copy tags, using -All will copy tags to their preferred location, which means they might change groups. For example, if you had the XMP:Headline tag in a file, using -All means the data will be written to IPTC:Headline instead. Using -All:All makes sure the data is written to the exact same group as well as tag. This is also explained in FAQ #9.

QuoteWhat @ does?

It is not a command by itself, but a parameter of the -TagsFromFile option listed before it. From the docs on the -TagsFromFile option
QuoteSRCFILE may be the same as FILE to move information around within a single file. In this case, @ may be used to represent the source file (ie. -tagsFromFile @)

When used after the -TagsFromFile option, it means you are copying the data from the same file. This is often used when you delete entire blocks, but want to keep a few of the tags. A common command would be to remove all the EXIF data, but keep the Orientation so the file is properly rotated when it is viewed
exiftool -EXIF:All= -TagsFromFile @ -Orientation /path/to/files/

Note that this is different from the -@ (Argfile) option.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

spippiy

Quote from: StarGeek on September 18, 2024, 10:18:49 AM
QuoteHow can you copy as a block and not as a block?

See the last paragraph in FAQ #9, "The tag locations change when I use -tagsfromfile to copy information".

Thank you for your answers, they are very clear, still I would like to understand better copying metadata as a block.

1) In the faq, it is stated that "all block types except EXIF, if copied as a block, the metadata is copied byte-for-byte from the original image". Does this mean that if I analyze the copied blocks with an hex editor, they would be exactly identical to the original?

2) In the faq it is mentioned that "certain types of meta information (such as EXIF, IPTC, XMP and ICC_Profile) may be copied as a block". Is there a list of all the groups that can be copied as a block?

3) In case, I would like to copy all the metadata from one image to another and at the same time copy as a block all the meta information that is possible to copy as a block, what the command would be?

Thank you and sorry for all the questions

StarGeek

Quote from: spippiy on September 21, 2024, 04:33:37 PM1) In the faq, it is stated that "all block types except EXIF, if copied as a block, the metadata is copied byte-for-byte from the original image". Does this mean that if I analyze the copied blocks with an hex editor, they would be exactly identical to the original?

I assume it will, with the exception for some parts of the EXIF block mentioned. I've never checked to see.

Quote2) In the faq it is mentioned that "certain types of meta information (such as EXIF, IPTC, XMP and ICC_Profile) may be copied as a block". Is there a list of all the groups that can be copied as a block?

They will be on the Extra Tags page. Check the notes column to see if it is a block.

Quote3) In case, I would like to copy all the metadata from one image to another and at the same time copy as a block all the meta information that is possible to copy as a block, what the command would be?

Try this. I believe that -All:All will cover all tags that aren't in a block and the block copies will overwrite anything coved in that block.
exiftool -TagsFromFile source.jpg -All:All -EXIF -XMP -IPTC -ICC_Profile (etc, all other block tags you want) target.jpg
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype