Unable to re-import metadata

Started by mazeckenrode, September 21, 2023, 04:06:02 PM

Previous topic - Next topic

mazeckenrode

As has been my routine for the past few years since discovering that Directory Opus writes EXIF metadata to a location other than the recently-standardized one for PNGs, I use DOpus to write metadata first, then use ExifTool to export and re-import all metadata.

Got an image file now named "2023-09-21 14;49;33 - MAZE - foobar2000 x32 Config.7z.b64.txt.png", which I've attempted to process that same way, but ExifTool won't re-import the metadata from the JSON file it just exported to, giving error message "No SourceFile 'T:/2023-09-21 14;49;33 - MAZE - foobar2000 x32 Config.7z.b64.txt.png' in imported JSON database". As is obvious, I don't have the file in a location with an excessively long path, and for the record, I routinely process similarly-named PNG files in this same way.

In case the length or any characters/combinations in the filename were an issue, I also temporarily renamed the file "File.png", exported and tried re-importing the metadata, but got the same error. Any idea what might be up?

Command line for export:

ExifTool -w %%f.%%e.json -json -struct -G -XMP:All -EXIF:All -IPTC:All -JFIF:All -PNG:All "<filepath>"

Command line for import:

ExifTool -m "-json=<filepath>.json" "<filepath>"

Using Windows 7 x64 and ExifTool v12.55.

Attached: "2023-09-21 15;46;11 - MAZE - Unimportable Metadata.7z" (3,723,389)

Contents:

"2023-09-21 15;46;11 - MAZE - Unimportable Metadata\"
  "2023-09-21 14;49;33 - MAZE - foobar2000 x32 Config.7z.b64.txt.png" (3,723,734) [1229 x 1336 x 24]
  "2023-09-21 14;49;33 - MAZE - foobar2000 x32 Config.7z.b64.txt.png.json" (979)

2023-09-21 15;46;11 - MAZE - Unimportable Metadata.7z

StarGeek

I don't have any problem here

I:\!test\2023-09-21 15;46;11 - MAZE - Unimportable Metadata>exiftool -ver
12.67

I:\!test\2023-09-21 15;46;11 - MAZE - Unimportable Metadata>exiftool -P -overwrite_original -all= "I:\!test\2023-09-21 15;46;11 - MAZE - Unimportable Metadata\2023-09-21 14;49;33 - MAZE - foobar2000 x32 Config.7z.b64.txt.png"
    1 image files updated

I:\!test\2023-09-21 15;46;11 - MAZE - Unimportable Metadata>ExifTool -m "-json=I:\!test\2023-09-21 15;46;11 - MAZE - Unimportable Metadata\2023-09-21 14;49;33 - MAZE - foobar2000 x32 Config.7z.b64.txt.png.json"  "I:\!test\2023-09-21 15;46;11 - MAZE - Unimportable Metadata\2023-09-21 14;49;33 - MAZE - foobar2000 x32 Config.7z.b64.txt.png"
    1 image files updated

I:\!test\2023-09-21 15;46;11 - MAZE - Unimportable Metadata>exiftool -G1 -a -s -e --file:all "I:\!test\2023-09-21 15;46;11 - MAZE - Unimportable Metadata\2023-09-21 14;49;33 - MAZE - foobar2000 x32 Config.7z.b64.txt.png"
[ExifTool]      ExifToolVersion                 : 12.67
[PNG]           ImageWidth                      : 1229
[PNG]           ImageHeight                     : 1336
[PNG]           BitDepth                        : 8
[PNG]           ColorType                       : RGB
[PNG]           Compression                     : Deflate/Inflate
[PNG]           Filter                          : Adaptive
[PNG]           Interlace                       : Noninterlaced
[IPTC]          ObjectName                      : 2023-09-21 14;49;33 - MAZE - foobar2000 x32 Config.7z.b64.txt.png
[IPTC]          ApplicationRecordVersion        : 4
[XMP-x]         XMPToolkit                      : XMP Core 5.1.2
[XMP-dc]        Title                           : 2023-09-21 14;49;33 - MAZE - foobar2000 x32 Config.7z.b64.txt.png
[XMP-exif]      UserComment                     : 2023-09-21 14;49;33 - MAZE - foobar2000 x32 Config.7z.b64.txt.png
[IFD0]          ImageDescription                : 2023-09-21 14;49;33 - MAZE - foobar2000 x32 Config.7z.b64.txt.png
[IFD0]          XResolution                     : 72
[IFD0]          YResolution                     : 72
[IFD0]          ResolutionUnit                  : inches
[IFD0]          YCbCrPositioning                : Centered
[IFD0]          XPComment                       : 2023-09-21 14;49;33 - MAZE - foobar2000 x32 Config.7z.b64.txt.png
[IFD0]          XPSubject                       : 2023-09-21 14;49;33 - MAZE - foobar2000 x32 Config.7z.b64.txt.png
[ExifIFD]       ExifVersion                     : 0232
[ExifIFD]       ComponentsConfiguration         : Y, Cb, Cr, -
[ExifIFD]       UserComment                     : 2023-09-21 14;49;33 - MAZE - foobar2000 x32 Config.7z.b64.txt.png
[ExifIFD]       FlashpixVersion                 : 0100
[ExifIFD]       ColorSpace                      : Uncalibrated

But that is only when I am in the same directory as the PNG file.  If I call it from a different directory
C:\>ExifTool -m "-json=I:\!test\2023-09-21 15;46;11 - MAZE - Unimportable Metadata\2023-09-21 14;49;33 - MAZE - foobar2000 x32 Config.7z.b64.txt.png.json"  "I:\!test\2023-09-21 15;46;11 - MAZE - Unimportable Metadata\2023-09-21 14;49;33 - MAZE - foobar2000 x32 Config.7z.b64.txt.png"
No SourceFile 'I:/!test/2023-09-21 15;46;11 - MAZE - Unimportable Metadata/2023-09-21 14;49;33 - MAZE - foobar2000 x32 Config.7z.b64.txt.png' in imported JSON database
(full path: 'i:/!test/2023-09-21 15;46;11 - maze - unimportable metadata/2023-09-21 14;49;33 - maze - foobar2000 x32 config.7z.b64.txt.png')

So, it looks because you only have the filename in the "SourceFile" entry, you either need to be in the correct directory, or edit the json file to include the full path.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

mazeckenrode

Quote from: StarGeek on September 21, 2023, 04:38:48 PMit looks because you only have the filename in the "SourceFile" entry, you either need to be in the correct directory, or edit the json file to include the full path.

Pretty sure I AM in the same directory for both export and import — what I do is accomplished via custom commands specified in my DOpus configuration, which get used as such multiple times each week — but I tried editing the JSON here to include the full path, and I'm getting the same error.

StarGeek

Run the command again and include -v3.  Then paste the full command and output, so we can see exactly what is happening.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

mazeckenrode

Quote from: StarGeek on September 21, 2023, 06:46:21 PMRun the command again and include -v3.  Then paste the full command and output, so we can see exactly what is happening.

(I was already typing this reply and was about to post it when I saw you had posted a new reply yourself. Feel free to find any new light I may have shed on the subject — if I actually did shed any — and ignore anything that's already been ruled out or is clearly due to my status as an amateur. I'll get to trying -v3 a bit later, for what it's worth.)

It appears that ExifTool at my end might have a problem importing the exported metadata containing " x32 " in one or more of the fields I have it in. (For those wondering but not worried about it enough to check it out for themselves, I had DOpus write the PNG's own filename to a variety of commonly-used comment/description/subject/title metadata fields, and nothing else.) I have now renamed the file "2023-09-21 14;49;33 - MAZE - foobar2000x32 Config.7z.b64.txt.png", wrote the new filename to those same fields using DOpus' built-in functionality, exported the metadata via ExifTool, and successfully re-imported it to the renamed PNG. Of course, this still begs the question of why the original filename/metadata worked for StarGeek but not for me. Maybe because we used different versions of ExifTool? (v12.55 for me, v12.67 for StarGeek) Perhaps I'll give v12.67 a go here tomorrow.

mazeckenrode

Huh. New info: I can't seem to import when image and JSON are in the root directory of ANY drive/partition. And that's where they were when this problem manifested itself. The ExifTool error message upon import attempt, quoted in my first post here, wasn't actually the full message, which is this (for a different image file):

No SourceFile 'D:/Clipboard Image.png' in imported JSON database
(full path: 'd://clipboard image.png')

Notice, there are TWO forward slashes included in the "full path". As intended?

mazeckenrode

Got an email notification last night indicating that Phil "ExifTool Author & Freak" Harvey posted a reply here, but I'm not seeing it. Phil?

StarGeek

Phil deleted it soon after posting, so he probably changed his mind about what he posted.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

mazeckenrode

Quote from: StarGeek on September 22, 2023, 11:19:06 AMPhil deleted it soon after posting

I see.

By any chance, are you able to confirm my findings re: importing to/from file in any root directory?

StarGeek

Still works correctly here
D:\>dir 2023*
 Volume in drive D is Slave
 Volume Serial Number is EE67-20D0

 Directory of D:\

2023-09-22  09:08 AM         3,722,200 2023-09-21 14;49;33 - MAZE - foobar2000 x32 Config.7z.b64.txt.png
2023-09-21  12:12 PM               979 2023-09-21 14;49;33 - MAZE - foobar2000 x32 Config.7z.b64.txt.png.json
2023-09-21  01:34 PM         3,720,624 2023-09-21 14;49;33 - MAZE - foobar2000 x32 Config.7z.b64.txt.png_original
               3 File(s)      7,443,803 bytes
               0 Dir(s)  284,567,117,824 bytes free

D:\>exiftool -P -overwrite_original -all= "2023-09-21 14;49;33 - MAZE - foobar2000 x32 Config.7z.b64.txt.png"
    1 image files updated

D:\>ExifTool -m "-json=2023-09-21 14;49;33 - MAZE - foobar2000 x32 Config.7z.b64.txt.png.json"  "2023-09-21 14;49;33 - MAZE - foobar2000 x32 Config.7z.b64.txt.png"
    1 image files updated

D:\>exiftool -G1 -a -s -e "2023-09-21 14;49;33 - MAZE - foobar2000 x32 Config.7z.b64.txt.png"
[ExifTool]      ExifToolVersion                 : 12.67
[System]        FileName                        : 2023-09-21 14;49;33 - MAZE - foobar2000 x32 Config.7z.b64.txt.png
[System]        Directory                       : .
[System]        FileSize                        : 3.7 MB
[System]        FileModifyDate                  : 2023:09:22 09:03:46-07:00
[System]        FileAccessDate                  : 2023:09:22 09:03:46-07:00
[System]        FileCreateDate                  : 2023:09:21 13:13:59-07:00
[System]        FilePermissions                 : -rw-rw-rw-
[File]          FileType                        : PNG
[File]          FileTypeExtension               : png
[File]          MIMEType                        : image/png
[File]          ExifByteOrder                   : Big-endian (Motorola, MM)
[PNG]           ImageWidth                      : 1229
[PNG]           ImageHeight                     : 1336
[PNG]           BitDepth                        : 8
[PNG]           ColorType                       : RGB
[PNG]           Compression                     : Deflate/Inflate
[PNG]           Filter                          : Adaptive
[PNG]           Interlace                       : Noninterlaced
[IPTC]          ObjectName                      : 2023-09-21 14;49;33 - MAZE - foobar2000 x32 Config.7z.b64.txt.png
[IPTC]          ApplicationRecordVersion        : 4
[XMP-x]         XMPToolkit                      : XMP Core 5.1.2
[XMP-dc]        Title                           : 2023-09-21 14;49;33 - MAZE - foobar2000 x32 Config.7z.b64.txt.png
[XMP-exif]      UserComment                     : 2023-09-21 14;49;33 - MAZE - foobar2000 x32 Config.7z.b64.txt.png
[IFD0]          ImageDescription                : 2023-09-21 14;49;33 - MAZE - foobar2000 x32 Config.7z.b64.txt.png
[IFD0]          XResolution                     : 72
[IFD0]          YResolution                     : 72
[IFD0]          ResolutionUnit                  : inches
[IFD0]          YCbCrPositioning                : Centered
[IFD0]          XPComment                       : 2023-09-21 14;49;33 - MAZE - foobar2000 x32 Config.7z.b64.txt.png
[IFD0]          XPSubject                       : 2023-09-21 14;49;33 - MAZE - foobar2000 x32 Config.7z.b64.txt.png
[ExifIFD]       ExifVersion                     : 0232
[ExifIFD]       ComponentsConfiguration         : Y, Cb, Cr, -
[ExifIFD]       UserComment                     : 2023-09-21 14;49;33 - MAZE - foobar2000 x32 Config.7z.b64.txt.png
[ExifIFD]       FlashpixVersion                 : 0100
[ExifIFD]       ColorSpace                      : Uncalibrated

D:\>
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

mazeckenrode

Update:

I find that I'm able to import to/from files in a root directory when I do so manually (open a command prompt in that directory, type command line, hit ENTER), but not when I utilize my DOpus custom command, which is technically as shown in my first post, but looks like this in the DOpus custom command dialog:

ExifTool -m "-json={filepath$}.json" "{filepath$}"

({filepath$} being the full pathname of the file currently selected in DOpus)

To verify that DOpus and {filepath$} are reporting the full pathname correctly, I've created another custom DOpus command with the following command line:

echo "{filepath$}"

That correctly reports the full pathname of (in this case):

"D:\Clipboard Image.png"

So I'm at a loss to explain where the incorrect...

(full path: 'd://clipboard image.png')

...reported in ExifTool's error message came from.

In any case, I did add -v3 to my custom DOpus/ExifTool command line, which resulted in:

Reading JSON file D:\Clipboard Image.png.json
Imported entry for 'Clipboard Image.png' (full path: 'd:/clipboard image.png')
======== D:/Clipboard Image.png
No SourceFile 'D:/Clipboard Image.png' in imported JSON database
(full path: 'd://clipboard image.png')

Doesn't look to me like that tells us anything new, but your mileage may differ.

mazeckenrode

StarGeek , if you don't mind indulging me once again, please try re-importing from a JSON again, but use the full pathname to at least the image file in a root directory, like this:

ExifTool -m "-json=D:\Clipboard Image.png.json" "D:\Clipboard Image.png"

When I do this manually (not via Directory Opus custom command), I get the...

No SourceFile 'D:/Clipboard Image.png' in imported JSON database
(full path: 'd://clipboard image.png')

...error every time. I also find that I can just use the filename (not full pathname) for the JSON file and still get the error, but if I change the image file reference to just the filename, the command completes successfully. Unless I'm missing something, that looks to me like ExifTool is the culprit for bungling the full pathname. Please confirm.

Phil Harvey

The command should work if there is a SourceFile entry that matches "D:/Clipboard Image.png" exactly.  The bungling to add the double "/" is in the Cwd::abs_path() library routine that ExifTool uses to find the absolute path, but this isn't done if an exact match is found.

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