ExifTool/Directory Opus incompatibilities

Started by mazeckenrode, June 07, 2018, 11:25:26 PM

Previous topic - Next topic

mazeckenrode

I offer this information in case it is useful for ExifTool development, though I can't say for sure that any fault lies with ExifTool (I suspect not).

Directory Opus is my file manager of choice, and I was, until recently (when I discovered ExifTool), using it exclusively for adding or editing any metadata in image files. Ideally, I would like to continue using DOpus for displaying the (limited) metadata it's capable of, and at least occasionally for adding/editing metadata under certain limited circumstances.

My main challenge is retaining metadata when editing images, as my image editors discard all of it when re-saving. I was looking for a way to preferably export all metadata from a file prior to editing, and then import it all back in afterwards, and ExifTool seems like it would fit the bill for this. DOpus, on the hand, provides a handy, convenient interface for adding and editing bits and pieces of metadata on the fly. Unfortunately, my experiments with the two programs seem to indicate some degree of incompatibility between the two, as far as how metadata is added. I created a dummy PNG (just a big white square) and used DOpus to add all the image metadata that it allows me to do. (It is acknowledged that camera-specific tags would not typically be added manually to an image file, but I did it anyway as part of the test.) I then used ExifTool v10.99 to export all metadata to a JSON file, using the following command line:

exiftool -json -struct -G ".\1_ALL-DOpus-tags.png"

For the sake of clarity, I made a copy of that JSON named "2a_Tags-for-Import.json". I then created a second dummy PNG file, and used ExifTool to import all metadata from the renamed JSON, using the following command line:

exiftool "-json=.\2a_Tags-for-Import.json" -m -a ".\2b_Tags-Imported-from-2a.png"

I then opened the second dummy PNG in DOpus' Set Metadata dialog, but only the following metadata fields (not counting file properties) were displayed as having any values:

   Instructions
   Title
   Comment
   Tags

I used ExifTool again, this time to read all tags from the PNG I had just imported to. It looks like all the necessary tags are there, but DOpus isn't displaying them. I do notice that, even though it looks like all the same tags are there (plus a few others that apparently did not exist in the first DOpus-tagged PNG), the tags aren't all listed by ExifTool in the same order in both PNGs.

I have not tried any of this with ExifTool v11.0 yet.

7-zip attached: "DOpus+ExifTool Export&Import JSON Test.7z" (4,028)

Contents:

"DOpus+ExifTool Export&Import JSON Test\"

"0_NO-tags.png" (5,322)

PNG with no tags that are displayable in DOpus

"0_NO-tags.json" (969)

All tags extracted from "0_NO-tags.png"

"1_ALL-DOpus-tags.png" (9,010)

PNG with ALL tags that are displayable in DOpus

"1_ALL-DOpus-tags.json" (3,436)

All tags extracted from "1_ALL-DOpus-tags.png"

"2a_Tags-for-Import.json" (3,452)

Copy of "1_ALL-DOpus-tags.json", edited for SOURCEFILE and FILENAME entries to better facilitate importing via ExifTool

"2b_Tags-Imported-from-2a.png" (7,710)

Copy of "0_NO-tags.png" with tags imported from "2a_Tags-for-Import.json"

"2c_Tags-Exported-from-2b.json" (3,732)

All tags extracted from "2b_Tags_Imported-from-2a.png"

StarGeek

Have you tried using a jpeg instead of a PNG?  Or using IPTC or XMP data instead of EXIF data.

There are two places where EXIF data may be stored in a PNG.  When the PNG format was defined, there wasn't a spec for including EXIF data.  Someone made a way to include EXIF data in the tEXt or zTXt block.  ImageMagick, Exiftool, and Exiv2 all supported this format.  It appears that Exiv2 library is used in Directory Opus (see Acknowledgements).

More recently, there is an official spec for including EXIF data in a PNG, the eXIf block.  Exiftool now writes to this block.

Phil will have to weigh in on the specifics in the files in this case, but my guess is that Directory Opus is writing to the old format using the exiv2 library and exiftool (which can read either format) is writing to the new format, which the exiv2 library that Directory Opus is unable to read.

So try writing to a jpg and see if you still have the problem.

Overall, PNG is a poor format when it comes to metadata, as very few programs will read the metadata properly.

Edit: If you run exiftool -v3 on 1_ALL-DOpus-tags.png and 2b_Tags-Imported-from-2a.png, you'll see that DOpus file has the EXIF data saved in a zTXt block, while the second file has it saved in an eXIf block. 
"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

#2
EXIF metadata in PNG images is problematic as StarGeek said.  The official specification for this is fairly recent, and probably not well supported.  ExifTool will read EXIF from anywhere, and will update EXIF in whatever location it finds it, but will always create EXIF in the official location if it didn't exist beforehand.

I will add a Warning about EXIF in non-standard locations in PNG images when the Validate option is used.  With this addition, your files give these warnings:

% exiftool -validate -warning -a -ext png .
======== ./0_NO-tags.png
Validate                        : OK
======== ./1_ALL-DOpus-tags.png
Validate                        : 14 Warnings (4 minor)
Warning                         : [minor] Non-standard EXIF in PNG Raw profile type exif chunk
Warning                         : [minor] Non-standard IFD0 tag 0x4746 Rating
Warning                         : [minor] Non-standard IFD0 tag 0x4749 RatingPercent
Warning                         : Non-standard format (rational64s) for ExifIFD 0x829a ExposureTime
Warning                         : Non-standard format (rational64s) for ExifIFD 0x829d FNumber
Warning                         : Non-standard format (rational64s) for ExifIFD 0x9202 ApertureValue
Warning                         : Non-standard format (rational64s) for ExifIFD 0x9206 SubjectDistance
Warning                         : Non-standard format (rational64s) for ExifIFD 0x920a FocalLength
Warning                         : Non-standard format (rational64s) for ExifIFD 0xa404 DigitalZoomRatio
Warning                         : Non-standard format (rational64s) for GPS 0x0002 GPSLatitude
Warning                         : Non-standard format (rational64s) for GPS 0x0004 GPSLongitude
Warning                         : Non-standard format (int32s) for GPS 0x0005 GPSAltitudeRef
Warning                         : Non-standard format (rational64s) for GPS 0x0006 GPSAltitude
Warning                         : [minor] Fixed incorrect URI for xmlns:MicrosoftPhoto
======== ./2b_Tags-Imported-from-2a.png
Validate                        : 2 Warnings (all minor)
Warning                         : [minor] Non-standard IFD0 tag 0x4746 Rating
Warning                         : [minor] Non-standard IFD0 tag 0x4749 RatingPercent
    1 directories scanned
    3 image files read


- Phil

Edit:  I have created an Exiv2 issue to request support for standard EXIF in PNG images.
...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 ($).

mazeckenrode

StarGeek and Phil, thank you for your informative replies.

StarGeek — I have not tried any of my metadata importing activities with JPEGs because I ultimately have been editing and storing images as lossless PNG. Is there another lossless format I should be using that gives me the flexibility of PNG and is better for dealing with metadata? My experience with TIFF is limited, but I wasn't happy with it.

— Andre

Phil Harvey

For a compressed+lossless image format with wide support, unfortunately PNG is what I would suggest.

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

bananasampler

Hi, sorry for reviving a several years old post, but I'm a bit stumped by this exact problem described in the thread, but it seems there was no ultimate solution or conclusion offered here.

I'm trying to write some custom comment metadata for PNG files into the appropriate field (either UserComment/XPComment or ImageDescription) using exiftool, and this works just fine with exiftool. However, I'm unable to see this data presented anywhere using Directory Opus (latest major 12 version). I'm also of course using the latest exiftool version (13.22) from the downloads section.

Indeed using the exiftool '-v3' flag I'm able to inspect that metadata written by dopus resides in a zTXt block, while exiftool writes into an eXIf block. Based on the previous posts and just Directory Opus is indeed seemingly unable to detect and read the metadata from the more appropriate block. But is it somehow possible to force exiftool to write the metadata in a way that is compatible with Directory Opus? I tried looking at the documentation but could not find such an option that works for me.

In fact I so far haven't been able to write any cross-compatible PNG metadata that dopus would be able to read, aside from ratings, which work fine when written using exiftool. Any guidance appreciated for writing dopus-compatible metadata, even if it ends up not being written to the recommended chunk in the file?

Phil Harvey

The tags you mention are all EXIF, which isn't very common in PNG images.  I would suggest writing either native PNG tags or standard XMP-dc tags.

But it may help to ask in a Directory Opus forum about what metadata is compatible with that software.

- 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: bananasampler on March 04, 2025, 07:40:59 PMBut is it somehow possible to force exiftool to write the metadata in a way that is compatible with Directory Opus? I tried looking at the documentation but could not find such an option that works for me.

No, I do not believe so. EXIF data in the tEXt/zTXt blocks was always non-standard. Exiftool writes to the location defined by the standard.

QuoteIn fact I so far haven't been able to write any cross-compatible PNG metadata that dopus would be able to read, aside from ratings, which work fine when written using exiftool. Any guidance appreciated for writing dopus-compatible metadata, even if it ends up not being written to the recommended chunk in the file?

Doing some quick searches, it looks like the exiv2 library that Dopus uses still doesn't write EXIF data according to the standard. So there isn't much you can do about that.

Have you tried writing to the XMP tags? Because if you're writing to Rating with exiftool, that is writing to XMP-xmp:Rating.

exiftool -XMP:ImageDescription=Description -XMP:UserComment=Comment file.png

The only other thing to do would be to revert to version 10.58, June 29, 2017.
"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

mazeckenrode

#8
Quote from: bananasampler on March 04, 2025, 07:40:59 PMI so far haven't been able to write any cross-compatible PNG metadata that dopus would be able to read, aside from ratings, which work fine when written using exiftool. Any guidance appreciated for writing dopus-compatible metadata, even if it ends up not being written to the recommended chunk in the file?

In case of interest or usefulness, I've gotten into the habit of populating all relevant supported metadata fields via Directory Opus first, then using ExifTool to export all metadata to JSON, and then re-importing it. I believe this results in the relevant EXIF tags existing in both locations (the location defined by the official spec, and also the location supported by DOpus.

I do practically all of my metadata writing/editing/updating, including the parts involving ExifTool, via custom commands in Directory Opus, by the way. My workflow can definitely use some streamlining, and gets some once in a while as I have time and inclination, but it sure beats doing it all manually. I'd be happy to share the DOpus custom command files I use, which may require tailoring to your own specific requirements, if you like.

On another subject, I'm trying to figure out why the ExifTool forum failed to notify me that there had been new replies to this topic, which I originally started 7 years ago. I just happened to notice that there were while scanning the forum for recent topics. Any ideas, Phil or StarGeek?

Phil Harvey

To get notifications, use the "RECIEVE EMAILS AND ALERTS" button at the top or bottom of this page.

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

mazeckenrode

I should have specified, but yes, I already had that enabled.

StarGeek



Really, though, try that.

I have whole sections of these forums set to let me know when a new post is made and I get email updates for them.
Clipboard_03-11-2025_01.png


But sometimes there can be a bit of delay in receiving them, especially when the (shared) server the forums are on are under a high load. I also had to set Google to never send emails from the forums to spam.
"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

mazeckenrode

Was working again as of Phil's reply to me today, but I didn't receive any emails or notifications for any of the posts on March 4th. Go figure.