Broken Samsung Smartphone DNG

Started by WalterS, April 15, 2024, 09:50:52 AM

Previous topic - Next topic

WalterS

My Samsung SM-G981B produces DNG files where the preview image is not readable/present and the following errors with exiftool:
Warning                         : SubIFD BitsPerSample should have 3 values
Warning                         : Undersized SubIFD StripByteCounts (571536 bytes, but expected 857304)
Is there a way to fix any of this?
I already tried to add a preview image to no avail and I have no clue about the error messages.
Using exiftool 12.70 on Linux

StarGeek

What version of exiftool are you using?
exiftool -ver

Can you provide a sample?
"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

WalterS

I use version 12.70 of exiftool on Linux and a sample file is here.
Using exiftool 12.70 on Linux

StarGeek

Looking though the output with the -v3 (-verbose3) option, I don't see any unknown blocks which are big enough to hold a preview image.

Phil will have to verify, of course.
"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

Phil Harvey

The preview image is stored uncompressed in SubIFD of this file:

> exiftool test.dng -G1 -subifd:all
[SubIFD]        Subfile Type                    : Reduced-resolution image
[SubIFD]        Image Width                     : 504
[SubIFD]        Image Height                    : 378
[SubIFD]        Bits Per Sample                 : 12
[SubIFD]        Compression                     : Uncompressed
[SubIFD]        Photometric Interpretation      : YCbCr
[SubIFD]        Strip Offsets                   : 26490
[SubIFD]        Samples Per Pixel               : 3
[SubIFD]        Rows Per Strip                  : 378
[SubIFD]        Strip Byte Counts               : 571536
[SubIFD]        Planar Configuration            : Chunky

As ExifTool reports when trying to write this file, there are problems here.  With 3 samples per pixel there should be 3 values for BitsPerSample.  However, ignoring this problem, the number of samples in the image is ImageWidth * ImageHeight * SamplesPerPixel = 504 * 378 * 3 = 571536.  This exactly matches the number of bytes in the single strip of image data.  Unfortunately there are supposed to be 12 bits per sample, but there are only 8 bits in a byte.  So the number of bytes must be greater than the number of samples.  Either that or the 12 BitsPerSample is wrong.

Either way, ExifTool doesn't have the ability to fix this mess.

- 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 ($).

Marsu42

Quote from: WalterS on April 15, 2024, 09:50:52 AMMy Samsung SM-G981B produces DNG files where the preview image is not readable/present and the following errors with exiftool

I've got nearly the same phone (Samsung S20, but Ultra) and have the same warning from exiftool validation - but it didn't cause any issue yet, because I convert the dngs with Adobe DNG Converter that compresses the files plus fixes most issues (including this one): https://helpx.adobe.com/camera-raw/using/adobe-dng-converter.html

The original Camera app is necessary to access all features hidden by Samsmung from the Camera2 api, i.e. highres jpeg/video and 10-bit video. However, if it's only about dng from front cameras, I recommend HedgeCam2 - it contains a custom dng creator (unpacked or 10-bit packed) that replaces the built-in one, and HedgeCam2 (or OpenCamera) are the better apps anyway: https://sourceforge.net/projects/hedgecam2/

Quote from: WalterS on April 15, 2024, 11:38:56 AMI use version 12.70 of exiftool on Linux

It's nice to have Linux and its automatic package managment, but with exiftool you might want to use at least the latest production release... https://exiftool.org/history.html