ExifTool Forum

ExifTool => Newbies => Topic started by: Bervoets on September 16, 2022, 08:12:27 AM

Title: -tagsfromfile corrupt destination file
Post by: Bervoets on September 16, 2022, 08:12:27 AM
Hello,

I'm using this to transfer EXIF data from one file to another:

exiftool -tagsFromFile "./tempimages/DSC00991.JPG" "./tempimages/D-25-DSC00992.jpg"

When using certain source files (which seem to be ok, see attachment) the destination file is corrupted.

Any help/tips will be appriciated.

Arie
Title: Re: -tagsfromfile corrupt destination file
Post by: greybeard on September 16, 2022, 08:27:57 AM
I can't see anything wrong with the file - even when tags are copied to another file.

The problem with the command (with the -m) is that the -m needs to be outside the quotes - in fact with this example you don't need quotes at all

Your command is looking for a file name : "./tempimages/20220901_141714_D-25-DSC00992.jpg -m"

Title: Re: -tagsfromfile corrupt destination file
Post by: Bervoets on September 16, 2022, 02:51:11 PM
Thanks Greybeard,

the -m was a typo. The instuction reads:
exiftool -tagsFromFile "./tempimages/DSC00991.JPG" "./tempimages/D-25-DSC00992.jpg"

Btw: the "'s were added because some filenames may contain spaces.

I'll do some more testing and supply files that do go wrong.

Title: Re: -tagsfromfile corrupt destination file
Post by: Bervoets on September 17, 2022, 06:14:48 AM
Hi Greybeard,

Be so kind to have a look at the following statements and files:

1)= exiftool -tagsFromFile "./tempimages/DSC00991.JPG" "./tempimages/DSC00991_DSC00992.jpg"
2)= exiftool -tagsFromFile "./tempimages/DSC00992.JPG" "./tempimages/DSC00992_DSC00991.jpg"

2) works OK an transfers EXIF from source to destination.
1) corrupts destination file.

Any suggestion?
Title: Re: -tagsfromfile corrupt destination file
Post by: greybeard on September 17, 2022, 06:32:32 AM
I downloaded the two files and ran command 1 - didn't get any problems - in what way is the destination file corrupted?

Are you running an up to date version of exiftool?
Title: Re: -tagsfromfile corrupt destination file
Post by: Bervoets on September 17, 2022, 01:26:36 PM
Hi Greybeard,

Thanks again for testing.

I've also tried:
perl C:/Windows/exiftool.pl -tagsFromFile "./tempimages/DSC00991.JPG" "./tempimages/DSC00991_DSC00992.jpg"
but that gives the same result.

I've installed EXIFTOOL version 12.45. Error occurs when running Localhost and also running on a host server.

I've used it on thousands of files without any problem, but only DSC00991.JPG generates the problem.

Attached are the files produced by 1). Using a hex-editor it seems there is some EXIF information in the DSC00991_DSC00992.jpg file. But the filesize is reduced to 46 KB (origional= 500 KB).

DSC00992.JPG is taken almost at the same time with the same camera but generates no problem.

You might try to run a test on olb.agbo.nl/mergeimage31a.php and download the result.

If the first (left) image is DSC00991.JPG the output is corrupted.

Thanks,

Arie

Title: Re: -tagsfromfile corrupt destination file
Post by: greybeard on September 18, 2022, 03:16:24 AM
I'm out of ideas - I haven't run your host code but if this also happens locally on the command line I'm assuming its not a host php problem.

Does exiftool give an error when you run it on the command line or does it appear as though it was successful?

Do you have an example of the corrupted DSC00991_DSC00992.jpg file from when you run it on the command line?
Title: Re: -tagsfromfile corrupt destination file
Post by: Phil Harvey on September 18, 2022, 08:03:08 AM
When I take a look at your 46 kB corrupted DSC00991_DSC00992.JPG file, it contains some information not found in either the original DSC00991.JPG or the original DSC00991_DSC00992.JPG.  So my guess is that your hard disk is seriously misbehaving.

Here is a hex dump of the start of the corrupted file:

    0000: ff d8 ff e0 00 10 4a 46 49 46 00 01 01 01 01 5e [......JFIF.....^]
    0010: 01 5e 00 00 ff ed 00 a2 50 68 6f 74 6f 73 68 6f [.^......Photosho]
    0020: 70 20 33 2e 30 00 38 42 49 4d 04 04 00 00 00 00 [p 3.0.8BIM......]
    0030: 00 86 1c 02 78 00 74 44 65 7a 65 20 66 6f 74 6f [....x.tDeze foto]
    0040: 20 69 73 20 6f 70 20 31 37 2d 30 39 2d 32 30 32 [ is op 17-09-202]
    0050: 32 20 6f 6d 20 31 39 3a 30 34 20 73 61 6d 65 6e [2 om 19:04 samen]
    0060: 67 65 73 74 65 6c 64 20 75 69 74 3a 20 44 53 43 [gesteld uit: DSC]
    0070: 30 30 39 39 31 2e 4a 50 47 20 65 6e 20 44 53 43 [00991.JPG en DSC]
    0080: 30 30 39 39 32 2e 4a 50 47 20 6d 65 74 20 76 65 [00992.JPG met ve]
    0090: 72 73 69 65 20 31 2e 33 31 61 20 76 6f 6c 67 6e [rsie 1.31a volgn]
    00a0: 75 6d 6d 65 72 3a 20 31 35 36 39 1c 02 37 00 08 [ummer: 1569..7..]
    00b0: 32 30 32 32 30 39 31 37 ff e1 b3 ee 45 78 69 66 [20220917....Exif]

I did a quick search for "17-09-2022" in all 3 of these files, and it only exists in the corrupted one.

- Phil
Title: Re: -tagsfromfile corrupt destination file
Post by: Bervoets on September 18, 2022, 11:16:30 AM
Hi Phil, CC:Greybeard,

Not quite. What you see is the IPTC caption information which program mergeimage31a.php adds to the destination file (see attatchment IPTC-info.JPG, translated: This photo was composed on September 17, 2022 at 7:04 PM from: DSC00991.JPG and DSC00992.JPG with version 1.31a sequence number: 1659).

Attached is the result of the EXIF transfer from DSC00992.JPG to DSC00992_DSC00991.JPG which goes OK and where you can see simular IPTC caption information (Deze foto is op 18-09-2022 om 17:04 samengesteld uit: DSC00992.JPG en DSC00991.JPG met versie 1.31a volgnummer: 1575).

BTW: I've removed the instructions which adds the IPTC info to the destination file and the EXIF transfer seem to work OK. But I've still no idea why the error only occurs with DSC00991.JPG as source file (and not with thousands of other files I've used).

Thank you all for your help so far. I'll do some more testing and when I find a clue I'll let you know.

Regards,