immich-go icon indicating copy to clipboard operation
immich-go copied to clipboard

`upload from-google-photos` does not upload both -edited versions of a photo, incorrectly detected as duplicate

Open paschun opened this issue 8 months ago • 1 comments

2025-04-06 01:30:57 INF scanned image file file=Dog:IMG-20150125-WA0005-edited.jpeg                                                  
2025-04-06 01:30:57 INF scanned image file file=Dog:IMG-20150125-WA0005.jpeg                                                         
2025-04-06 01:30:57 INF scanned sidecar file file=Dog:IMG-20150125-WA0005.jpeg.supplemental-metadata.json type=asset metadata title=IMG-20150125-WA0005.jpeg date=2015-01-25 18:20:49   
2025-04-06 01:30:57 INF associated metadata file file=Dog:IMG-20150125-WA0005.jpeg json=IMG-20150125-WA0005.jpeg.supplemental-metadata.json matcher=matchNormal
2025-04-06 01:30:57 INF associated metadata file file=Dog:IMG-20150125-WA0005-edited.jpeg json=IMG-20150125-WA0005.jpeg.supplemental-metadata.json matcher=matchEditedName 

2025-04-06 01:31:27 INF uploaded file=Dog:IMG-20150125-WA0005-edited.jpeg                                                            
2025-04-06 01:31:27 INF added to an album file=Dog:IMG-20150125-WA0005-edited.jpeg album=Dog                                        
2025-04-06 01:31:27 INF Tagged file=Dog:IMG-20150125-WA0005-edited.jpeg tag=Dog                                                     
2025-04-06 01:31:27 INF server has a better asset file=Dog:IMG-20150125-WA0005.jpeg reason=An asset with the same name:"IMG-20150125-WA0005.jpeg" and date:"2015-01-25 18:20:49" but with bigger size:476.3 KB exists on the server. No need to upload. 

2025-04-06 01:31:27 INF Stacked file=Dog:IMG-20150125-WA0005-edited.jpeg                                                             
2025-04-06 01:31:27 INF Stacked file=Dog:IMG-20150125-WA0005.jpeg   

In this scenario, there are 2 versions of a file that was edited with google photos, and a single metadata json for both of them.

> ls -lh IMG-20150125-WA0005*
442K IMG-20150125-WA0005.jpeg
477K IMG-20150125-WA0005-edited.jpeg
693 IMG-20150125-WA0005.jpeg.supplemental-metadata.json

The edited version is slightly larger, as you might expect if there is no crop. However during the upload, the edited version is uploaded first. Then the unedited version is attempted to be uploaded, but the edited version is detected as "higher quality" , and the unedited version is skipped for upload.

Then it attempts to stack the two images, as it should. But there is only one image in the stack.

Both the images should be uploaded.

paschun avatar Apr 11 '25 12:04 paschun

The reason for this behavior is the detect variants of the same image after the compression done by google. So when sever images share the same name, the same date of capture, the heaviest is supposed the be to original one, and is kept.

I don't see a solution for this problem that fits all possible cases.

simulot avatar Apr 11 '25 12:04 simulot