Changing Metadata breaks Windows Explorer showing thumbnail

Started by axel.hennig, April 07, 2025, 07:05:11 AM

Previous topic - Next topic

axel.hennig

Hi,

I've got a problem with the attached file (zipped that Metadata does not get destroyed), but not sure, if it is an exiftool-problem or a Windows problem (I'm working with Windows 11).

The attached file shows a thumbnail in Windows Explorer (see screenshot 1).

sc1.jpg

But after running the following command:

exiftool.exe -overwrite_original_in_place -EXIF:OwnerName="StefanWeisshap" -XMP-exifEX:OwnerName="StefanWeisshap" 01.jpg
The file does not show that thumbnail anymore (screenshot 2).

sc2.jpg

The two OwnerName tags before editing the file were:

[ExifIFD]       OwnerName                       : StefanWeissha
[XMP-exifEX]    OwnerName                       : StefanWeissha

And afterwards:
[ExifIFD]       OwnerName                       : StefanWeisshap
[XMP-exifEX]    OwnerName                       : StefanWeisshap

So, I've just added a "p" at the end.

Does anybody know why Windows is not able to show the thumbnail anymore?

StarGeek

I can't replicate this on my Windows 10 machine. What Windows are you using and what version of exiftool?
exiftool -ver

The most common reason why a thumbnail would break on Windows is because it's too big. JPEG metadata is split into segments which can be a max of 64KB-1 byte. So a thumbnail bigger than that gets split across two segments. Windows has a problem with this, but most image software does not.

But that's not the case here. The thumbnail is small, the rest of the data fairly normal and doesn't seem that it would break the block size.

Not that it would change anything, but I would suggest using the -overwrite_original option instead of the -overwrite_original_in_place option. It's quicker and the only reason you would need to use the -overwrite_original_in_place on Windows would be if you are using Alternate Data Streams (ADS). The Zone Identifier, which browsers use to set data on downloaded files, is the most common ADS.
"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

axel.hennig

Hi StarGeek,

thanks for your quick reply.

I'm using Windows 11 Pro, 24H2, 26100.3624, Windows Feature Experience Pack 1000.26100.66.0
sc1.jpg

And, I run this test with exiftool verion 13.25

I was also posting this problem (slightly differently phrased, but same "source"-problem) on IMatch-forum (Digital Asset Management software which uses exiftool in the background) here: https://www.photools.com/community/index.php/topic,15105.0.html

And there, I got the reply, that it might be related to Windows WIC codec failing to show this image after editing. How can I find out which WIC codec I am running?

I was just wondering how this can happen after such a small metadata-change.

axel.hennig

In the IMatch software I mentioned above there is a WIC-diagnosis tool, with the following result on that image:

List of installed WIC codecs:
Codec 'BMP Decoder' (Vendor: F0E749CA-EDEF-4589-A73A-EE0E626A2A2B) for extensions .bmp,.dib,.rle
Codec 'GIF Decoder' (Vendor: F0E749CA-EDEF-4589-A73A-EE0E626A2A2B) for extensions .gif
Codec 'ICO Decoder' (Vendor: F0E749CA-EDEF-4589-A73A-EE0E626A2A2B) for extensions .ico,.icon
Codec 'CUR Decoder' (Vendor: F0E749CA-EDEF-4589-A73A-EE0E626A2A2B) for extensions .cur
Codec 'JPEG Decoder' (Vendor: F0E749CA-EDEF-4589-A73A-EE0E626A2A2B) for extensions .jpeg,.jpe,.jpg,.jfif,.exif
Codec 'PNG Decoder' (Vendor: F0E749CA-EDEF-4589-A73A-EE0E626A2A2B) for extensions .png
Codec 'TIFF Decoder' (Vendor: F0E749CA-EDEF-4589-A73A-EE0E626A2A2B) for extensions .tiff,.tif
Codec 'DNG Decoder' (Vendor: F0E749CA-EDEF-4589-A73A-EE0E626A2A2B) for extensions .dng
Codec 'WMPhoto Decoder' (Vendor: F0E749CA-EDEF-4589-A73A-EE0E626A2A2B) for extensions .wdp,.jxr
Codec 'DDS Decoder' (Vendor: F0E749CA-EDEF-4589-A73A-EE0E626A2A2B) for extensions .dds
Codec 'Microsoft HEIF Decoder' (Vendor: F0E749CA-EDEF-4589-A73A-EE0E626A2A2B) for extensions .heic,.heif,.hif,.avci,.heics,.heifs,.avcs,.avif,.avifs
Codec 'Microsoft Webp Decoder' (Vendor: F0E749CA-EDEF-4589-A73A-EE0E626A2A2B) for extensions .webp
Codec 'Microsoft Raw Image Decoder' (Vendor: F0E749CA-EDEF-4589-A73A-EE0E626A2A2B) for extensions .3FR,.ARI,.ARW,.BAY,.CAP,.CR2,.CR3,.CRW,.DCS,.DCR,.DRF,.EIP,.ERF,.FFF,.IIQ,.K25,.KDC,.MEF,.MOS,.MRW,.NEF,.NRW,.ORF,.ORI,.PEF,.PTX,.PXN,.RAF,.RAW,.RW2,.RWL,.SR2,.SRF,.SRW,.X3F,.DNG
Codec 'Microsoft JPEG XL Decoder' (Vendor: F0E749CA-EDEF-4589-A73A-EE0E626A2A2B) for extensions .JXL

WIC: Testing file 'D:\z_tmp\01.jpg'
    Thumbnail: Codec ''
        (CreateDecoderFromFilename failed (88982F61 Der Imageheader ist unbekannt.).) 0x0 pixel in 0 ms.
    Preview: Codec ''
        (CreateDecoderFromFilename failed (88982F61 Der Imageheader ist unbekannt.).) 0x0 pixel in 0 ms.
    Full resolution: Codec ''
        (CreateDecoderFromFilename failed (88982F61 Der Imageheader ist unbekannt.).) 0x0 pixel in 0 ms.

WIC Result: It looks like no WIC codec is installed which can handle this file.

"Der Imageheader ist unbekannt" (German) means: Imageheader unknown.

StarGeek

Take a look at this copy of the file. This is what I get after running your command. Does the thumbnaill break for this?

I looked at the header with a text editor and there's no real difference between the before and after.

Can you post a copy of your after file?
"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

axel.hennig

Thanks again for looking into this.

Quote from: StarGeek on April 07, 2025, 02:04:29 PMTake a look at this copy of the file. This is what I get after running your command. Does the thumbnaill break for this?

Yes, it breaks (see screenshot).

sc1.jpg

The two files attached (02.jpg and 03.jpg) are derived via (I was thinking, maybe it makes a difference):

exiftool.exe -overwrite_original -EXIF:OwnerName="StefanWeisshap" -XMP-exifEX:OwnerName="StefanWeisshap" 02.jpg
exiftool.exe -overwrite_original_in_place -EXIF:OwnerName="StefanWeisshap" -XMP-exifEX:OwnerName="StefanWeisshap" 03.jpg

Quote from: StarGeek on April 07, 2025, 02:04:29 PMI looked at the header with a text editor and there's no real difference between the before and after.

You mean just opening the *.jpg-file e.g. in Notepad++? Where does the header start and end? I get the following when opening in a text editor:

sc2.jpg


axel.hennig

When opening both file (01 -> working | 02 -> breaking) with a text editor and saving what I see as a *.txt file. Then comparing both *.txt-files in WinMerge (diff-tool), I get the following:

sc3.jpg

Just a screenshot, but there are some differences...

Phil Harvey

Very strange.

I think StarGeek meant a hex editor maybe?

The files both look good to me.  I was looking at the exiftool -htmldump output.

The thumnail for "01 - Copy.jpg" shows up in MacOS.

Sounds like a Windows 11 problem since StarGeek says the thumbnail also shows up in Windows 10.  But it would be interesting to know what difference is triggering the issue.

- 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

Quote from: axel.hennig on April 07, 2025, 03:58:41 PMYes, it breaks (see screenshot).

I'm at a loss here. My thought was maybe it's the start of a drive failure, so data is getting corrupted. While still a possibility, I thought that saving my copy would have avoided it.

Check the WIC diagnostics in my IMatch, I get the same results for JPEGs
Codec 'JPEG Decoder' (Vendor: F0E749CA-EDEF-4589-A73A-EE0E626A2A2B) for extensions .jpeg,.jpe,.jpg,.jfif,.exif
QuoteThe two files attached (02.jpg and 03.jpg) are derived via (I was thinking, maybe it makes a difference):

There isn't a difference between the two commands, they just work in slightly different ways. When editing a file, exiftool creates a new copy of the file with the changes. If there isn't an error, it rename or delete (if -overwrite_original is used) the original and rename the new copy. -overwrite_original_in_place, upon success, opens the original file and then copies the contents of the new file into the original, then deletes the new copy. This takes twice as long so it isn't advised for most commands.

Quote
Quote from: StarGeek on April 07, 2025, 02:04:29 PMI looked at the header with a text editor and there's no real difference between the before and after.

You mean just opening the *.jpg-file e.g. in Notepad++? Where does the header start and end? I get the following when opening in a text editor:

My mistake. I meant to say I opened it up in a hex editor.

Here's what you can see in a hex editor

First the original
HxD-2025-04-07_13.24.31.png

And the edited copy
HxD-2025-04-07_13.25.23.png

The first four bytes (FF D8 FF E1) are the JPEG "Magic Number" the byte sequence that identifies it as a JPEG (though that last byte can vary).

The next byte, 0F, is the start of the EXIF data, with the next one after (F8 and FA) that indicating the size of the block. Because exiftool is more optimized, there is a change in the block size (see FAQ #13, Why is my file smaller after I use ExifTool to write information?).
"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

StarGeek

Last thing to check. What is the program that gives you that icon? Maybe associating a different program with JPEG files?
"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

axel.hennig

Quote from: StarGeek on April 07, 2025, 04:39:06 PMLast thing to check. What is the program that gives you that icon? Maybe associating a different program with JPEG files?
The program is XnView.

Changing to Windows-Paint does not help (just the icon changes, but no thumbnail visible).

I've checked on two other Windows-PCs and on both of them it works (meaning, that I'm also not able to reproduce on other PCs).

Must be definitely something on my PC. Maybe DirectX bug or WIC codec bug... don't know (and even don't know how to update them).

But thanks again for your help, really appreciated.

axel.hennig

#11
@StarGeek:
I'm not completely sure, but the fact that IMatch WIC Codec Report for JPEG Decoder is the same for both of us may just mean that it is Microsoft WIC codec.

It just says (Vendor):
Vendor: F0E749CA-EDEF-4589-A73A-EE0E626A2A2B

So maybe I've got a buggy version of that...

axel.hennig

@StarGeek: Due to the fact, that you are also using IMatch: Could you do me a favor and import one of the "broken" jpgs (e.g. the one you've uploaded "01 - Copy.jpg") into an IMatch test DB?

If you are willing to do that and run the WIC diagnosis on that image (IMatch -> Help -> Support -> WIC Diagnostics...), does it also fail?

Reason for asking: Mario also reports that the broken jpg fails on his PC (just WIC codec, maybe not Windows Explorer thumbnail).

So, I'm wondering why you see a thumbnail on your PC and the WIC diagnosis (might) still fail(s).


FrankB

FYI

Sometimes the Windows Thumbnail Cache can get corrupt. (Experience from ExifToolGui)
CleanMgr.exe can be used to clear the cache and force regeneration of the thumbnails.

cleanmgr.jpg