deckerst / aves

Aves is a gallery and metadata explorer app, built for Android with Flutter.
BSD 3-Clause "New" or "Revised" License
2.77k stars 106 forks source link

Camera photo tagging issue #1269

Closed rajagr closed 3 days ago

rajagr commented 3 weeks ago

Describe the bug Whenever I try to tag a photo in aves gallary which was clicked through camera, it says done but when searching the photo does it not appear, and when viewing the photo after tagging there is no tag shown in info, video can be tagged though. Please help. Other folder pictures I have not issues.

To Reproduce Steps to reproduce the behavior:

  1. Go to '...' camera folder in aves and open some photo.
  2. Go to tag
  3. generate or use tags which you want and click tick mark to finalise
  4. It says done

Expected behavior When I want to tag camera photos it should be tagged successful and I should be able to retrieve the photo with correct tag.

Screenshots I tagged it this photo as shoes but it does not appear when searching the tag. And in more info xmp it shows the tag in info, I have attached ss. Screenshot_20241030-194539 Screenshot_20241030-194524

(mailto:gallery.aves@gmail.com).

System information and logs: In the app, there are instructions in the About page > Bug Report section. After following them, paste here your system information and attach your logs.

Logs ``` 10-30 19:43:25.572 25500 25500 I d.t.a.MainActivity: onStart 10-30 19:43:25.573 25500 25536 I flutter : Report log=Lifecycle hidden 10-30 19:43:25.574 25500 25536 I flutter : Report log=Lifecycle inactive 10-30 19:43:25.628 25500 25536 I flutter : Report log=Lifecycle resumed 10-30 19:43:27.472 25500 25536 I flutter : Report log=Nav pop to /viewer 10-30 19:43:27.658 25500 25547 D MediaScannerConnection: Scanned /storage/emulated/0/DCIM/Camera/IMG_20241030_133617375.jpg to content://media/external_primary/images/media/1000050847 10-30 19:43:27.680 25500 25536 I flutter : SqfliteLocalMediaDb saveMetadata complete in 0ms for 1 entries 10-30 19:43:27.680 25500 25536 I flutter : Evict cached images for uri=content://media/external/images/media/1000050847, mimeType=image/jpeg, dateModifiedSecs=1730275580, rotationDegrees=0, isFlipped=false 10-30 19:43:27.680 25500 25536 I flutter : reinitialize controllers for entry=AvesEntry#cc237{id=9315, uri=content://media/external/images/media/1000050847, path=/storage/emulated/0/DCIM/Camera/IMG_20241030_133617375.jpg, pageId=null} because metadata changed 10-30 19:43:27.732 25500 25519 W b.P : failed to read metadata by metadata-extractor for mimeType=image/jpeg uri=content://media/external/images/media/1000050847 10-30 19:43:27.732 25500 25519 W b.P : h2.d: File format could not be determined 10-30 19:43:27.732 25500 25519 W b.P : at h2.c.a(SourceFile:22) 10-30 19:43:27.732 25500 25519 W b.P : at h6.a.s(SourceFile:40) 10-30 19:43:27.732 25500 25519 W b.P : at b6.P.U(SourceFile:102) 10-30 19:43:27.732 25500 25519 W b.P : at b6.P.z(SourceFile:637) 10-30 19:43:27.732 25500 25519 W b.P : at b6.P.y(SourceFile:71) 10-30 19:43:27.732 25500 25519 W b.P : at b6.P.e(SourceFile:1) 10-30 19:43:27.732 25500 25519 W b.P : at b6.P$V$a.n(SourceFile:15) 10-30 19:43:27.732 25500 25519 W b.P : at b6.P$V$a.k(SourceFile:5) 10-30 19:43:27.732 25500 25519 W b.P : at b6.o$a.a(SourceFile:21) 10-30 19:43:27.732 25500 25519 W b.P : at b6.P$V.u(SourceFile:24) 10-30 19:43:27.732 25500 25519 W b.P : at e7.a.m(SourceFile:12) 10-30 19:43:27.732 25500 25519 W b.P : at x7.U.run(SourceFile:129) 10-30 19:43:27.732 25500 25519 W b.P : at C7.n$a.run(SourceFile:4) 10-30 19:43:27.732 25500 25519 W b.P : at E7.k.run(SourceFile:3) 10-30 19:43:27.732 25500 25519 W b.P : at E7.a.H(SourceFile:1) 10-30 19:43:27.732 25500 25519 W b.P : at E7.a$c.d(SourceFile:15) 10-30 19:43:27.732 25500 25519 W b.P : at E7.a$c.p(SourceFile:29) 10-30 19:43:27.732 25500 25519 W b.P : at E7.a$c.run(SourceFile:1) 10-30 19:43:27.732 25500 25536 I flutter : reinitialize controllers for entry=AvesEntry#cc237{id=9315, uri=content://media/external/images/media/1000050847, path=/storage/emulated/0/DCIM/Camera/IMG_20241030_133617375.jpg, pageId=null} because metadata changed 10-30 19:43:27.769 25500 25536 I flutter : failed to find ScaffoldMessenger in context 10-30 19:43:27.847 25500 25500 E a.a : encodeErrorEnvelope failed with errorCode=getThumbnail-null, errorMessage=failed to get thumbnail for mimeType=image/jpeg uri=content://media/external/images/media/1000050847, errorDetails=J1.q: Failed to load resource 10-30 19:43:27.847 25500 25536 I flutter : ThumbnailProvider _loadAsync failed with mimeType=image/jpeg, uri=content://media/external/images/media/1000050847, error=FormatException: Expected envelope, got nothing 10-30 19:43:28.660 25500 25536 I flutter : Report log=MediaStoreSource refresh start for 1 uris 10-30 19:43:28.715 25500 25536 I flutter : Report log=MediaStoreSource refresh end for 1 uris 10-30 19:43:30.151 25500 25536 I flutter : Report log=EntryAction.editTags 10-30 19:43:30.151 25500 25536 I flutter : Report log=EntryAction.editTags 10-30 19:43:30.153 25500 25536 I flutter : Report log=Nav push to /info/tag_editor 10-30 19:43:31.698 25500 25536 I flutter : Report log=Nav pop to /viewer ```

Add any other context about the problem here.

deckerst commented 3 weeks ago

Thanks for the report. Could you please send me: 1) a photo from your camera before tagging, 2) a photo from your camera after tagging.

If it's the same photo before and after, even better.

rajagr commented 3 weeks ago

Yes sure sir, uploading, the tag I have created is "diwali"

Before tagging -

IMG_20241031_120431800.jpg

After tagging - IMG_20241031_120431800.jpg

rajagr commented 3 weeks ago

I just noticed after tagging the camera photo there's a secondary photo created, I am not able to find more details about it, but I'll add a recording video for you to see.

https://github.com/user-attachments/assets/ff5ee75a-9a6a-4128-bece-f2911ab36a74

IMG_20241031_123510766.jpg

deckerst commented 3 weeks ago

Thanks for the samples and recording.

The issue is probably related to the Ultra HDR format of your photos (images that contain a gain map to dynamically display it in SDR or HDR). I'll need to take a closer look.

Happy Diwali!

rajagr commented 3 weeks ago

A Very Happy and Auspicious Diwali to you too🪔🪔

After your diagnosis, I disabled ultra xdr format in my camera setting (nothing phone 2). Now, I can tag new clicked pictures and it is working perfectly. The issue is solved for future purposes. For old photos there is still an issue as I cannot sort or manage images. If you could help with this issue. It will be really helpful. But regardless, thank you for such customer service. And one more thing, Aves gallery app is very good by long shot and no one comes close 👍.

shift18 commented 5 days ago

I believe I'm experiencing the same tagging issue At first i thought it was some kind of compatibility issue as I was using xnview mp on my computer to tag images, (although I thought i had confirmed It's compatibility with Aves) but after removing all metadata on these images I'm still unable to get tags displaying although they've apparently been written to metadata. That is to say, aves has issues reading XMP DC subject lines written both by it self and xnview mp.

Summary: Aves won't display XMP/DC/ subject lines written by xnview MP as tags Aves wont display XMP/DC/ subject lines written by itself as tags.

Example Images tagged by xnview mp https://github.com/user-attachments/assets/f07a6627-9539-4785-ad43-7cce1a188ea9 https://github.com/user-attachments/assets/fbffa05c-e63f-47b9-9ad8-b3794752320b

Aves: 1.11.17 Camera/Phone: pixel 6a bluejay Camera app: Google Camera OS: GrapheneOS 2024110700

P.S. I'm motivated to further help investigate this issue in any way possible, give me shout if there's anything that needs debugging or testing.

deckerst commented 3 days ago

Quick diagnosis, there are 2 issues: 1) Aves and XnView MP fail to update the position offsets of sub-images contained via MPF (like Ultra HDR, which is a JPEG with an embedded gain map image), so the edited images have MPF metadata pointing to obsolete offsets and it's difficult (or impossible?) to retrieve the contained sub-images. 2) Aves fails to read XMP metadata when cataloguing images with messed-up MPF offsets, even though it's capable to display that metadata in the Info page.

Issue 2 is the one revealed by OP, but issue 1 is also important because editing with Aves (and XnView MP) possibly degrades Ultra HDR images to simple SDR images with an embedded gain map that cannot be used.

deckerst commented 3 days ago

I've fixed the issue 2 mentioned above. To retrieve the tags with the next release of Aves, you'll need to select these images in the Collection page and select rescan in the top right menu.

shift18 commented 3 days ago

Quick diagnosis, there are 2 issues:

1. Aves and XnView MP fail to update the position offsets of sub-images contained via MPF (like Ultra HDR, which is a JPEG with an embedded gain map image), so the edited images have MPF metadata pointing to obsolete offsets and it's difficult (or impossible?) to retrieve the contained sub-images.

2. Aves fails to read XMP metadata when cataloguing images with messed-up MPF offsets, even though it's capable to display that metadata in the `Info` page.

Issue 2 is the one revealed by OP, but issue 1 is also important because editing with Aves (and XnView MP) possibly degrades Ultra HDR images to simple SDR images with an embedded gain map that cannot be used.

So the metadata is accually needed to properly display the (HDR) image!? I had no idea, funny i haven't noticed any difference though.

I purged the metadata from those images before posting (though i re-added the tags using xnview MP).

Thank you for the all the effort you've been putting in to order to squash these bugs, you most definitely deserve a commendation!

deckerst commented 3 days ago

So the metadata is accually needed to properly display the (HDR) image!?

I believe both XMP (which indicates there is a gain map) and MPF (which defines how images are contained) are necessary to reconstruct the HDR image from the primary SDR image along with the secondary HDR gain map. If the MPF offsets become obsolete, it's probably possible to recover the correct offsets, but not sure how yet.

I had no idea, funny i haven't noticed any difference though.

Currently, Aves is unable to properly display HDR images. It always shows the basic SDR images, so you wouldn't notice the difference if you check them in Aves, but you should be able to see the difference in, say, Google Photos.

shift18 commented 3 days ago

So the metadata is accually needed to properly display the (HDR) image!?

I believe both XMP (which indicates there is a gain map) and MPF (which defines how images are contained) are necessary to reconstruct the HDR image from the primary SDR image along with the secondary HDR gain map. If the MPF offsets become obsolete, it's probably possible to recover the correct offsets, but not sure how yet.

I had no idea, funny i haven't noticed any difference though.

Currently, Aves is unable to properly display HDR images. It always shows the basic SDR images, so you wouldn't notice the difference if you check them in Aves, but you should be able to see the difference in, say, Google Photos.

Ahh, I see, that's why I've never noticed it. Googles property image - No thanks! I much rather use Aves

shift18 commented 1 day ago

I 've checked out 11.1.18 and i don't seem too have any issues with tags any more. Thank you yet again @deckerst