[]BBD Duplicate IA Description when write file

Started by javiavid, September 12, 2025, 04:34:37 PM

Previous topic - Next topic

javiavid

I am having a problem in IMatch with the generation of the description with AI. I generate the description and it works well, but when I write the file the description is doubled or triples without doing anything inside imatch.

The saved file is fine and if I return to write the file, the duplicate description is not written, but the visualization of the description is bad.

I think the problem is only in the DNG files, I have tried HEIC and JPG and works well.

I attach an image so you can try it:
https://drive.google.com/file/d/1AyomM2gRWgOOa6hnmCiWKDHRigUC7D5k/view?usp=sharing

Mario

I will look into this next week or when I have a free time slot.
Probably something with the existing metadata in your files.

Please provide details about your metadata setting (screen shot): Edit > Preferences > Metadata 1 and Metadata 2.
Anything non-standard?
Which device and/or application has produced the DNG file? Was it later edited?

Did you run the Metadata Analyst to check if the file in question has metadata problems. Duplication of metadata usually indicates metadata problems, e.g. mismatch between XMP and legacy IPTC, EXIF description out-of-sync etc.

Note: Please always ZIP log files when attaching. This saves about 95% disk space on my server.

Mario

Can you please upload the original of the DNG file (or a untouched DNG file from the same device)?

Because the file you have provided seems to have duplicate XMP records. For example, when I use the ExifTool Command Processor with "list metadata", I see this:

[XMP-iptcExt]  Location Created                : [{City=Paradores Cañadas del Teide,CountryCode=ESP,CountryName=España,GPSAltitude=2132.81,GPSLatitude=28.223186,GPSLongitude=-16.631353,ProvinceState=Canarias,Sublocation=}]
[XMP-iptcExt]  Location Created City          : Paradores Cañadas del Teide
[XMP-iptcExt]  Location Shown                  : [{City=Paradores Cañadas del Teide,CountryCode=ESP,CountryName=España,GPSAltitude=2132.81,GPSLatitude=28.223186,GPSLongitude=-16.631353,ProvinceState=Canarias,Sublocation=}]
[XMP-iptcExt]  Location Shown City            : Paradores Cañadas del Teide
[XMP-photoshop] City                            : Paradores Cañadas del Teide
[XMP-iptcExt]  Location Created                : [{City=Paradores Cañadas del Teide,CountryCode=ESP,CountryName=España,GPSAltitude=2132.81,GPSLatitude=28.223186,GPSLongitude=-16.631353,ProvinceState=Canarias,Sublocation=}]
[XMP-iptcExt]  Location Created City          : Paradores Cañadas del Teide
[XMP-iptcExt]  Location Shown                  : [{City=Paradores Cañadas del Teide,CountryCode=ESP,CountryName=España,GPSAltitude=2132.81,GPSLatitude=28.223186,GPSLongitude=-16.631353,ProvinceState=Canarias,Sublocation=}]
[XMP-iptcExt]  Location Shown City            : Paradores Cañadas del Teide
[XMP-photoshop] City                            : Paradores Cañadas del Teide

and when I look at description, I also see two XMP records for both XMP-dc and XMP-tiff:
[IFD0]          Image Description              : Un paisaje desértico árido se extiende bajo un cielo nublado con el sol brillando intensamente.
[XMP-dc]        Description                    : Un paisaje desértico árido se extiende bajo un cielo nublado con el sol brillando intensamente.
[XMP-tiff]      Image Description              : Un paisaje desértico árido se extiende bajo un cielo nublado con el sol brillando intensamente.
[XMP-dc]        Description                    : Un paisaje desértico árido se extiende bajo un cielo nublado con el sol brillando intensamente.
[XMP-tiff]      Image Description              : Un paisaje desértico árido se extiende bajo un cielo nublado con el sol brillando intensamente.

at least this is what ExifTool returns for the file.

javiavid

Hi, I share the another original file without going through any software. It is made with an iPhone 15 pro max in iOS 26 (RC version).

https://drive.google.com/file/d/1GniUaofUExtv0yJ2YZJ2KUGhwcbMNMJA/view?usp=sharing

JohnZeman

I wonder if javiavid's problem isn't similar to the problem I had 3 years ago when I first got my iPhone 14 Pro.  I don't remember exactly what the problem was that I had but it was some kind of a metadata problem.

After analyzing my problem Mario suggested the very first thing I should do after importing a new raw file to IMatch from my iPhone was to use ExifTool to delete all of the XMP metadata from the iPhone DNG.

Once I started doing that the problem I had disappeared and hasn't come back.

javiavid

Thanks for the comment, I hope this can be solved automatically so as not to add one more step.

Mario

#6
@John: The fresh image file provided contains no XMP metadata.

I've added the image to a database and used the Metadata Panel to add headline, description, author, keywords and a couple of other tags. Write back works fine, no warnings or errors from ExifTool.

Looking at the description in the file shows (correctly):

[IFD0]          Image Description              : Description
[XMP-dc]        Description                    : Description
[XMP-exif]      User Comment                    : Description
[XMP-tiff]      Image Description              : Description
[ExifIFD]      User Comment                    : Description

No duplication so far. I now change the description, headline, add a new keyword, set a rating and label.
I write back the second time. No warnings from ExifTool. The image now shows:

[IFD0]          Image Description              : Description 2
[XMP-dc]        Description                    : Description 2
[XMP-exif]      User Comment                    : Description 2
[XMP-tiff]      Image Description              : Description 2
[ExifIFD]      User Comment                    : Description 2

Again, no duplication.
Now I use AutoTagger and let it set description, keywords and headline.
Write back again. Now the description shows:

[IFD0]          Image Description              : A close-up view reveals a grey pair of over-ear headphones with brown earcups, displaying the brand logo prominently on one earcup against a red background.
[XMP-dc]        Description                    : A close-up view reveals a grey pair of over-ear headphones with brown earcups, displaying the brand logo prominently on one earcup against a red background.
[XMP-exif]      User Comment                    : A close-up view reveals a grey pair of over-ear headphones with brown earcups, displaying the brand logo prominently on one earcup against a red background.
[XMP-tiff]      Image Description              : A close-up view reveals a grey pair of over-ear headphones with brown earcups, displaying the brand logo prominently on one earcup against a red background.
[ExifIFD]      User Comment                    : A close-up view reveals a grey pair of over-ear headphones with brown earcups, displaying the brand logo prominently on one earcup against a red background.

I cannot reproduce the duplication and the image has only one XMP record, which is correct.

Is there anything I do different than you? What are the exact steps you perform to produce this duplication issue? Do you process the file before adding it to IMatch?

JohnZeman

Quote from: Mario on September 14, 2025, 06:36:05 PM@John: The fresh image file provided contains no XMP metadata.

Mario I didn't provide an image so I think you meant to respond to javiavid.

@javiavid deleting all XMP metadata is actually very simple for me, I created a favorite button that does it.  That button removes all XMP metadata, the next favorite button adds all of my default metadata, and the third button renames the image for me.  So it's 1-2-3 and I'm done except for assigning categories, writing a description, and using AutoFill to add the location.

Mario

Yes, I meant the second image he provided. It has no XMP metadata at all, which made me wonder.

Using Favorites to streamline the workflow is very efficient. Once setup, it can indeed by 1-2-3 to get most of the boring work done automatically. I have offloaded a lot of metadata "finalization" merging/copying to the metadata template than is run by AutoTagger once it has finished an image. 

javiavid

I will study the favorites seems interesting.

I just tested with the last image that I sent (headphones) and works well.
I have tried other photos that I took the weekend and works badly.

The only difference between some photos and others is that for the photo of the headphones the GPS turns off to the phone before taking the photo.

Can that be the problem?


Mario

Maybe an enabled GPS causes your phone to write different metadata to the image?
GPS data is part of EXIF, but also of XMP. 
You can compare the metadata with Metadata Compare & Sync or look at it in the ExifTool Command Processor.
Providing a sample file which "works badly" (unmodified, as produced by the phone) would be helpful. 

javiavid

I did evidence with and without GPS and it seems that the error is not there.
I attach an image that always fails. It is the original image without going through iMatch or any software.

To clarify it, I tell you the process:

- Copy of the original file to your folder.
- Imatch, rescan now
- I select Image, use autotagger and the description of the photo is correct.
- Write-back metadata, the visualization of the description metadata is duplicate.

If I use Autotagger again, the metadata is correct, the problem is when writing it in the file.
The metadata in the file from outside iMatch is never duplicate.

IMAGE 3 - always error
https://drive.google.com/file/d/1PuQdemr19qYINQwFFhmpYUNkEoL9XGc0/view?usp=sharing


Autotagger description prompt
{File.Persons.Label.Confirmed|hasvalue:These persons are shown in this image: {File.Persons.Label.Confirmed|splitlist: ,first}.}
Describe esta imagen en una sola linea al estilo de los pies de foto de las revistas. Utilice un lenguaje factual.Usa el español.


javiavid


Mario

I can reproduce the problem. IMatch is writing one description and two keywords. And ExifTool somehow doubles that.
I will post a question in the ExifTool forum. Please keep the image in your cloud space so Phil can download it when needed.

javiavid

Ok, I don't eliminate it until it is solved. Thank you

Mario

I've got first feedback from Phil. The problem is caused by the existing 3 XMP tags Apple has written to the image. They are not in the standard/preferred location ExifTool uses. And this causes a duplication of the XMP record in the file during write-back - one in the location chosen by Apple, and one in the preferred location of ExifTool (and Adobe, and ...).

So @JohnZeman was right with his comment about deleting existing XMP data to work around this problem!
When I run the Delete XMP Metadata preset in the ExifTool command processor, and then write back, no XMP duplication occurs anymore.

Phil told me that there is a flag for ExifTool which can prevent that.
I have asked him if and which consequences / side-effects this flag could have. I don't want to solve an issue one user has with some of his files and then cause an avalanche of side effects and metadata problems for all other users...

Apple - always so special.

Mario

#16
OK, problem understood and I have a solution.
Do what John suggested, delete the XMP metadata in affected files once using the "Delete XMP metadata preset" in the ExifTool command processor. You can create a favorite for it if you need it often.

Phil described the problem in this thread: https://exiftool.org/forum/index.php?topic=17628

According to the DNG spec:

You cannot view this attachment.
But Apple stores it in a SubIFD. And this causes the issue in your case. Adobe uses the correct location, so do, apparently, all other devices and applications which create DNG files, including ExifTool.

This is why the issue is so rare and affects only DNG files produced by Apple. It's just another one of the many metadata issues and bugs we have seen with Apple over the years.

Running the Delete XMP Metadata ECP preset once wipes the partial XMP record Apple stores (only 3 tags) and ExifTool then automatically creates and uses the official XMP storage location in the DNG. No data duplication, compatible XMP record.

Feel free to ask your local Apple "genius" or Apple support to make their devices follow the DNG specification and store the XMP record where other software, including Adobe's DNG converter, stores it.


I've updated the Metadata Analyst to show a new warning [minor] Non-standard XMP at TIFF-IFD0-SubIFD1-XMP if ExifTool detects this and added a paragraph to the Metadata Pitfalls section in the Metadata for Beginners help topic for the next release.