darktable-org / darktable

darktable is an open source photography workflow application and raw developer
https://www.darktable.org
GNU General Public License v3.0
9.77k stars 1.14k forks source link

HEIF Metadata not being exported to other formats #15075

Closed etrigan63 closed 10 months ago

etrigan63 commented 1 year ago

Describe the bug

When I export a JPEG from an HEIF file, no metadata is included in the JPEG. I have metadata and EXIF enabled in the export preferences and if I export from a RAF file all is well. However, with exporting from an HEIF file, no metadata is exported.

Steps to reproduce

  1. Open an HEIF image.
  2. Check the Image Information tab to confirm the existence of metadata.
  3. Check Export preferences to make sure metadata is exported.
  4. Export image to JPEG/PNG (or whatever).
  5. Check metadata in exported file using another application like digikam.
  6. Metadata will be missing.

Expected behavior

darktable should embed metadata in the exported file

Logfile | Screenshot | Screencast

No response

Commit

No response

Where did you install darktable from?

distro packaging

darktable version

4.4.2

What OS are you using?

Linux

What is the version of your OS?

Arcolinux (Arch based rolling release)

Describe your system?

AMD 5950X CPU AMD RX6750 XT GPU 64GB RAM hyprland window manager (Wayland) Oodles of nVMe and SSD storage

Are you using OpenCL GPU in darktable?

Yes

If yes, what is the GPU card and driver?

AMD RX6750 XT 12GB Kernel 6.1.45-1-lts driver

Please provide additional context if applicable. You can attach files too, but might need to rename to .txt or .zip

Link to sample file: https://nextcloud.echenique.com/s/CBcQBt649bAyN4M

kmilos commented 1 year ago

Can't reproduce here (Windows, exiv2 0.27.7).

Arch uses exiv2 0.28.0, so that could be a factor, but can't test unfortunately...

Note also that metadata addition sometime fails if you're exporting to network drives (like OneDrive and similar) that are syncing as they can lock the files temporarily...

etrigan63 commented 1 year ago

I am exporting to a local drive (SSD). Internally, the metadata is present and readable on the source file. I just don't see it in the exported jpeg. _

Nilvus commented 1 year ago

I can reproduce too on my side (Debian Sid with Exiv2 0.27.6) with file linked below. No metadata when exporting that file even if metadata and EXIF data are checked to be exported.

Nilvus commented 1 year ago

Oh, another thing I notice (could be related and so maybe another upstream bug) is that I can't read image with Gthumb 3.12.2 and is supposed to support HEIF since at least 3.11. Same on Gimp 2.10.34 which should open and export them (I even do not have HEIF format is menu of supported format on open and export as dialog windows. Strange but I will not investigate as I don't use HEIF format. Hope that could help for that issue, maybe not a darktable one.

I can read your file though wit EOG (Eye of Gnome) and darktable of course.

etrigan63 commented 1 year ago

GIMP 2.10.34 on my system (Arch based) works as expected. Debian Sid may have very old versions. Ristretto can view the .HIF files. Digikam can read the EXIF from the GIMP exported jpegs.

Nilvus commented 1 year ago

Debian Sid has same version as yours

etrigan63 commented 1 year ago

Then I have no explanation as to why my Gimp worked and yours did not.

etrigan63 commented 1 year ago

Any updates as to why this is happening? Digikam reads/exports EXIF data correctly. DT reads it but does not export.

kmilos commented 1 year ago

Any updates as to why this is happening?

There's not enough information to progress this. For example, I still can't reproduce (Windows, master branch, exiv2 0.27.7).

Have you tried running exiftool (w/ -v option), and/or exiv2 (w/ e.g. -pa and -pS options) on both the HEIF and exported JPEG? I'm attaching my outputs, all the expected metadata is there:

IMG-20230729-4763.hif.-v.txt IMG-20230729-4763.hif.-pS.txt IMG-20230729-4763.hif.-pa.txt

IMG-20230729-4763.jpg.-v.txt IMG-20230729-4763.jpg.-pS.txt IMG-20230729-4763.jpg.-pa.txt

GIMP 2.99.16 on Windows also has no problems seeing that metadata:

image

etrigan63 commented 1 year ago

Exiv2 reports corrupted metadata. exiv2-screenshot And here is the output from exiftool: IMG-20230906-0527.hif.txt

kmilos commented 1 year ago

Not the same test image, is it? It's not easy to debug a moving target 😉

Also, how about the exported JPEG test?

Finally, the output of your exiv2 command demonstrates that the Arch 0.28.0-3 package version does not include the patch for https://github.com/darktable-org/darktable/issues/14473

etrigan63 commented 1 year ago

Just ran exiv2 against the original file and it gives the same error. I contacted the exiv2 team and the error has been corrected but has not been published. https://github.com/Exiv2/exiv2/pull/2612

kmilos commented 1 year ago

So this smells like it is still related to, if not a duplicate of #14473

In order to confirm, one would have to build the exiv2 0.28.x branch on Arch as 0.28.0 there is affected, or 0.27.7 on Debian, as 0.27.6 it ships is affected as well.

kmilos commented 1 year ago

What is also interesting here is that we have added in dt 4.4 a fallback mechanism to read metadata from HEIFs if exiv2 fails, which is possibly why you still see something in the "image information" panel. So there just might be a separate issue here (still TBC) - this not being treated the same as exiv2 read metadata and exported?

In this case, there also might be a difference in how the image is actually exported - from lighttable (metadata not loaded because of exiv2), vs when actually opened in darkroom (went through libheif fallback)?

etrigan63 commented 1 year ago

It sounds like the export module is not using the fallback mechanism for the metadata.

kmilos commented 1 year ago

The fallback mechanism is only used on import/open, just like exiv2 parsing.

etrigan63 commented 1 year ago

Well, there's a disconnect somewhere because the light table and sidebar are full of metadata and the export is choosing to ignore it. Isn't the point of a "fallback mechanism" to provide an alternative method to complete a task when the primary method fails?

kmilos commented 1 year ago

Isn't the point of a "fallback mechanism" to provide an alternative method to complete a task when the primary method fails?

Yes. It was to get the metadata in. Once in, we assumed it would be handled and used the same as the metadata that got in via exiv2. As to why that doesn't seem to be the case, I have no clue ATM, but at least we have a hypothesis someone can start testing and debugging now...

kmilos commented 1 year ago

@TurboGit Are we maybe missing some db sync here?

github-actions[bot] commented 12 months ago

This issue has been marked as stale due to inactivity for the last 60 days. It will be automatically closed in 300 days if no update occurs. Please check if the master branch has fixed it and report again or close the issue.

etrigan63 commented 12 months ago

This issue is now fixed. You may close the ticket. EXIF data is exporting correctly from HEIF files.

kmilos commented 12 months ago

This issue is now fixed. You may close the ticket.

It was fixed as a side effect of exiv2 update. It would still be good to figure out why the fallback mechanism is not working.

etrigan63 commented 12 months ago

Agreed, but I don't know how to do that. I will help in any way I can. [image: photo] Carlos Echenique Photographer at CE Photography P 305.219.2433 <305.219.2433> E @. @.> W ce.photography https://mailtrack.io/link/0f3fea690a76decf01bcaf1262da1bea7d64c6fa?url=https%3A%2F%2Fcephotographic.com&userId=3957204&signature=e3d908f1c2f86f61 https://mailtrack.io/link/77feda95c41483a09c1d3641840c813239a4c196?url=http%3A%2F%2Finstagram.com%2Fcephotographic&userId=3957204&signature=346db17e0c2ce9a7 https://mailtrack.io/link/4284da374a0a8b77f53624fc2263af2a6a154a4d?url=http%3A%2F%2Ffacebook.com%2Fcephotos&userId=3957204&signature=de792e4027c50370 https://mailtrack.io/link/d709768218090471467844e701ad1f977a5badea?url=http%3A%2F%2Fwww.flickr.com%2Fphotos%2Fechenique&userId=3957204&signature=eec8b356f8e84b12

"Wine is constant proof that God loves us and loves to see us happy." - Benjamin Franklin.

On Wed, Nov 15, 2023 at 4:35 AM Miloš Komarčević @.***> wrote:

This issue is now fixed. You may close the ticket.

It was fixed as side effect of exiv2 update. It would still be good to figure out why the fallback mechanism is not working.

— Reply to this email directly, view it on GitHub https://github.com/darktable-org/darktable/issues/15075#issuecomment-1812102580, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABYBYQHMV7N2M7IW72LOGPLYESEEJAVCNFSM6AAAAAA3TOH7NCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMJSGEYDENJYGA . You are receiving this because you authored the thread.Message ID: @.***>

github-actions[bot] commented 10 months ago

This issue has been marked as stale due to inactivity for the last 60 days. It will be automatically closed in 300 days if no update occurs. Please check if the master branch has fixed it and report again or close the issue.