Star Rating disappears when NEF is updated with CountryCode

Started by Viktor Nemeth, November 26, 2022, 05:13:16 AM

Previous topic - Next topic

Viktor Nemeth

This is a little tricky and possible obscure but I'm trying to understand if I'm doing something wrong or is a bug. (in my world the prior is quite a possibility). It may also just be a bug in ACR/Bridge.

I have a NEF file. This is straight out of the camera. Observe that in the first few lines of the NEF file it says rating <xmp:Rating>0</xmp:Rating> - I think this is how the Nikon D5 creates files.

In Adobe Bridge (2022) I tag that file as (say) 3 star rating. That creates an XMP file automatically but does not write anything into the NEF file itself. Rating shows as 3 as expected.

I then use ET to issue the following command(s):
D:\temp\_DSC1444.NEF
-progress
-CountryCode=GBR
-XMP-iptcCore:CountryCode=GBR
-overwrite_original_in_place
-execute

In the xmp file the rating remains 3, the NEF file's rating isn't affected because it's not edited. Bridge shows the file as 0 rating.

Why would editing CountryCode change the file in a way that Bridge thinks it's a zero-rating?
ps. even if I take out the -XMP-iptcCore:CountryCode=GBR and just leave -CountryCode=GBR the result will be the same.

Joanna Carter

If you edit a file, like you did, with Adobe Bridge, it will write the metadata to an XMP sidecar file. The NEF file will not be altered in any way.

When you amend the NEF file with ExifTool, my guess is that Bridge is always attempting to read the file with the latest timestamp, in which case, because you last edited the NEF file, it reverts to reading that.

If you want to edit metadata for a file that already has an XMP sidecar, you really need to continue editing the sidecar as it is deemed to have superseded the RAW file.

So, your code for ExifTool should be...
exiftool -countrycode=GBR _DSC1444.xmp

Phil Harvey

Thanks Joanna!  I don't know if I would have figured this out.

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

Viktor Nemeth

It's not though I'm afraid. I'm not at home atm but if I use any other tag (not country code) the problem doesn't come up. I'll do a video on Monday if preferred.

Phil Harvey

I think it would solve the problem if the metadata in both files was synchronized.

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

Viktor Nemeth

Did a bit more testing - the xmp/nef logic isn't quite relevant.
And it's not just the countrycode.
The following(s) are in args files.
(the .xmp file is originally created by Bridge and it stores the 3-star rating in the xmp file. -- happy to upload any files you may need.)

this misbehaves ( = drops the rating in Bridge)
c:\temp\_DSC1444_test.NEF
-progress
-CountryCode=GBR
-Country=United Kingdom of Great Britain and Northern Ireland (the)
-State=England
-Sub-location=Blackwall
-overwrite_original
-execute
c:\temp\_DSC1444_test.xmp
-progress
-CountryCode=GBR
-Country=United Kingdom of Great Britain and Northern Ireland (the)
-State=England
-Sub-location=Blackwall
-overwrite_original
-execute


as does this

c:\temp\_DSC1444_test.NEF
-progress
-XMP-photoshop:City=Greater London
-XMP-iptcCore:CountryCode=GBR
-XMP-photoshop:Country=United Kingdom of Great Britain and Northern Ireland (the)
-XMP-photoshop:State=England
-XMP-iptcCore:Location=Blackwall
-overwrite_original
-execute
c:\temp\_DSC1444_test.xmp
-progress
-XMP-photoshop:City=Greater London
-XMP-iptcCore:CountryCode=GBR
-XMP-photoshop:Country=United Kingdom of Great Britain and Northern Ireland (the)
-XMP-photoshop:State=England
-XMP-iptcCore:Location=Blackwall
-overwrite_original
-execute


...any of the above (individual) lines will misbehave (you can take out all of them and just leave one in, they'll all misbehave) - on further inspection City also does misbehave.
you can switcheroo around the nef and xmp updates (ie do just nef but no xmp), same result.

This is ok but note that this excludes the above tags
c:\temp\_DSC1444_test.NEF
-ignoreMinorErrors
-progress
-GPSAltitude=14
-exif:GPSAltitude=14
-GPSLatitude=51.510011
-GPSLatitudeRef=North
-exif:GPSLatitude=51.510011
-GPSLongitude=-0.003626
-GPSLongitudeRef=West
-exif:GPSLongitude=-0.003626
-iptc:codedcharacterset=utf8
-overwrite_original
-execute


Note that on purpose in this one I left the xmp file not-updated.

this also works ok (xmp included, otherwise identical to the above)
c:\temp\_DSC1444_test.NEF
-ignoreMinorErrors
-progress
-GPSAltitude=14
-exif:GPSAltitude=14
-GPSLatitude=51.510011
-GPSLatitudeRef=North
-exif:GPSLatitude=51.510011
-GPSLongitude=-0.003626
-GPSLongitudeRef=West
-exif:GPSLongitude=-0.003626
-iptc:codedcharacterset=utf8
-overwrite_original
-execute
c:\temp\_DSC1444_test.xmp
-ignoreMinorErrors
-progress
-GPSAltitude=14
-exif:GPSAltitude=14
-GPSLatitude=51.510011
-GPSLatitudeRef=North
-exif:GPSLatitude=51.510011
-GPSLongitude=-0.003626
-GPSLongitudeRef=West
-exif:GPSLongitude=-0.003626
-iptc:codedcharacterset=utf8
-overwrite_original
-execute


If you'd like i can do a video. (?)
I also tested poking around with the timestamps of files, it doesn't seem to affect the outcome.

Phil Harvey

I don't have time to study this in detail, but I notice that you are updating both XMP and IPTC.  Whenever you do this, you should take care to either update or delete IPTCDigest because if this exists with an incorrect value it is likely that Adobe products will ignore the XMP.

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

Viktor Nemeth

>> update IPTCDigest

How do I do that pls? Happy to test...

Viktor Nemeth

Btw if i force it as

c:\temp\_DSC1444_test.NEF
-progress
-CountryCode=GBR
-Country=United Kingdom of Great Britain and Northern Ireland (the)
-State=England
-Sub-location=Blackwall
-Rating=3
-overwrite_original
-execute

...it does the magic. (note the Rating=3)

StarGeek

It appears to me that Bridge is giving priority to the NEF file.  Whenever you update anything, it's re-reading the NEF file with it's Rating of 0.  It isn't until you update the Rating in the NEF that the value changes after an update.

I'm failing to see how any of this is anything but a Bridge problem.  Exiftool updates the files as you are asking.  It's Bridge that is where your problem is.  Either sync the data between the NEF and sidecar or remove Rating from the NEF altogether.
"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

I still don't know if this is part of the issue, but you can delete the IPTCDigest with -iptcdigest= or update it with -iptcdigest=new

- 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: Phil Harvey on November 26, 2022, 09:42:17 PMI still don't know if this is part of the issue, but you can delete the IPTCDigest with -iptcdigest= or update it with -iptcdigest=new

The sample image doesn't have one to begin with and I don't see anything in the given commands that would add one, i.e. no MWG tags written.  So I doubt that's the problem.

Side note, writing IPTC data, specifically iptc:codedcharacterset, to an XMP file does nothing, as an XMP sidecar file can only contain XMP data.  Any tag starting with IPTC: is part of the older IPTC IIM/Legacy standard and different than IPTC Core/Ext, which are XMP.
"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

Viktor Nemeth

Quote from: StarGeek on November 26, 2022, 07:49:53 PMIt appears to me that Bridge is giving priority to the NEF file.  Whenever you update anything, it's re-reading the NEF file with it's Rating of 0.  It isn't until you update the Rating in the NEF that the value changes after an update.

I'm failing to see how any of this is anything but a Bridge problem.  Exiftool updates the files as you are asking.  It's Bridge that is where your problem is.  Either sync the data between the NEF and sidecar or remove Rating from the NEF altogether.

That's ok, I'll just force a write of Rating into the nef file :)
Thanks for confirming

Viktor Nemeth

Quote from: StarGeek on November 27, 2022, 12:53:14 AM
Quote from: Phil Harvey on November 26, 2022, 09:42:17 PMI still don't know if this is part of the issue, but you can delete the IPTCDigest with -iptcdigest= or update it with -iptcdigest=new

The sample image doesn't have one to begin with and I don't see anything in the given commands that would add one, i.e. no MWG tags written.  So I doubt that's the problem.

Side note, writing IPTC data, specifically iptc:codedcharacterset, to an XMP file does nothing, as an XMP sidecar file can only contain XMP data.  Any tag starting with IPTC: is part of the older IPTC IIM/Legacy standard and different than IPTC Core/Ext, which are XMP.

Noted, will rewrite logic, thanks