Author Topic: ExifTool/Directory Opus incompatibilities  (Read 250 times)

mazeckenrode

  • Newbie
  • *
  • Posts: 2
ExifTool/Directory Opus incompatibilities
« on: June 07, 2018, 11:25:26 PM »
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”
« Last Edit: June 08, 2018, 09:25:06 AM by mazeckenrode »

StarGeek

  • Global Moderator
  • ExifTool Freak
  • *****
  • Posts: 1854
Re: ExifTool/Directory Opus incompatibilities
« Reply #1 on: June 08, 2018, 12:36:19 AM »
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. 
Troubleshooting hints:
* When posting, include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).
* Double all percent signs (%) in a Windows batch file.
* If you GPS coords are negative, make sure and set the GpsLatitudeRef and GpsLongitudeRef tags correctly.

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 13199
    • ExifTool Home Page
Re: ExifTool/Directory Opus incompatibilities
« Reply #2 on: June 08, 2018, 08:36:51 AM »
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:

Code: [Select]
% 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.
« Last Edit: June 08, 2018, 09:14:54 AM by Phil Harvey »
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

mazeckenrode

  • Newbie
  • *
  • Posts: 2
Re: ExifTool/Directory Opus incompatibilities
« Reply #3 on: June 08, 2018, 09:39:56 AM »
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

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 13199
    • ExifTool Home Page
Re: ExifTool/Directory Opus incompatibilities
« Reply #4 on: June 08, 2018, 09:43:04 AM »
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, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).