ExifTool Forum

ExifTool => Bug Reports / Feature Requests => Topic started by: Pierre5018 on January 29, 2021, 10:00:45 PM

Title: Error reading image data when writing dng files from phone Samsung S20 5G
Post by: Pierre5018 on January 29, 2021, 10:00:45 PM
Windows 10 professional x64, 20H2
Command line :  exiftool -m -all= -tagsfromfile @ -all:all -unsafe -icc_profile filename.dng
version : exiftool-12.16
Output from tool

Warning: SubIFD BitsPerSample should have 3 values - C:/Users/pierr/Pictures/2021-01-29St-Laurent/20210129_163226.dng
Error: Error reading image data - C:/Users/pierr/Pictures/2021-01-29St-Laurent/20210129_163226.dng
    0 image files updated
    1 files weren't updated due to errors


Title: Re: Error reading image data when writing dng files from phone Samsung S20 5G
Post by: Phil Harvey on January 30, 2021, 07:09:43 AM
ExifTool won't rewrite a file if the image data is compromised.  This file is corrupted somehow.

I can't say more without seeing a sample.  You can send it to me if you want (philharvey66 at gmail.com).

- Phil
Title: Re: Error reading image data when writing dng files from phone Samsung S20 5G
Post by: Phil Harvey on January 30, 2021, 09:26:29 AM
I got the sample:

> exiftool ~/Desktop/SamsungGalaxyS20_5G.dng -validate -warning -a
Validate                        : 3 Warnings
Warning                         : SubIFD BitsPerSample should have 3 values
Warning                         : Undersized SubIFD StripByteCounts (230400 bytes, but expected 345600)
Warning                         : SubIFD:StripOffsets+StripByteCounts runs past end of file


It is that last Warning that is the real problem.  It looks like the file has been truncated, with about 100 kB missing somehow.  Only 115200 bytes of the strips exist.

Does this happen for original DNG files from this phone?  Or have they been modified by some other software?

- Phil
Title: Re: Error reading image data when writing dng files from phone Samsung S20 5G
Post by: Pierre5018 on January 30, 2021, 12:04:36 PM
The sample is a copy of the file straight out of the phone.
I will resend it from the phone.
Title: Re: Error reading image data when writing dng files from phone Samsung S20 5G
Post by: Pierre5018 on January 30, 2021, 03:50:19 PM
Sent
Title: Re: Error reading image data when writing dng files from phone Samsung S20 5G
Post by: Phil Harvey on January 30, 2021, 03:50:49 PM
Exact same problem with this one.  Must be a phone software bug.

- Phil
Title: Re: Error reading image data when writing dng files from phone Samsung S20 5G
Post by: Pierre5018 on January 30, 2021, 05:37:33 PM
I want to edit standard exif fields: camera model and make.
Shouldn't exiftool-m option allow to ignore the non-conformity, i.e. allow updating fields while keeping the rest of the file untouched ?

I am hoping to do this in batch using a command such as:
exiftool -m -Make="Apple" -Model="iPhone 8 Plus" -o %d%f_spoof.%e FILE ...
Title: Re: Error reading image data when writing dng files from phone Samsung S20 5G
Post by: Phil Harvey on January 31, 2021, 09:14:15 PM
-m only downgrades minor errors.  Any error involving potential loss of image data is not minor.  ExifTool can not be used to edit a file like this.  Your only recourse (other than getting Samsung to fix this bug, which may happen eventually with a software update) is to find some software that will read these files and write an output file without this problem.

- Phil
Title: Re: Error reading image data when writing dng files from phone Samsung S20 5G
Post by: Pierre5018 on February 01, 2021, 12:06:52 AM
I found that Adobe DNG converter can process this file without problem. The result can be tweaked using Exiftool.

Going back to the Samsung dng file, couldn't you make Exiftool ignore this error, and allow change exif fields that are correctly identified.

The original dng image is not corrupted:  it can be read by at least two photo editors, and the DNG converter.

Thanks for your help. 
Title: Re: Error reading image data when writing dng files from phone Samsung S20 5G
Post by: Phil Harvey on February 01, 2021, 07:17:16 AM
The original DNG was not written correctly.  Either the strip byte counts are wrong or the strip data is truncated.  Without processing the image, you can't tell which.  ExifTool does not process image data, so the only safe thing to do is to refuse to write these files.  Otherwise ExifTool could potentially further damage the image.

- Phil
Title: Re: Error reading image data when writing dng files from phone Samsung S20 5G
Post by: Pierre5018 on February 01, 2021, 08:12:05 AM
How about a more permissive option for letting through more severe errors?

For example  an option -mSevere.  The risk will be fully understood by the user, if that is really what the user wants.


-- Pierre
Title: Re: Error reading image data when writing dng files from phone Samsung S20 5G
Post by: Phil Harvey on February 01, 2021, 08:22:21 AM
Sorry, but I'm standing firm on this one.

- Phil