RhetTbull / osxphotos

Python app to work with pictures and associated metadata from Apple Photos on macOS. Also includes a package to provide programmatic access to the Photos library, pictures, and metadata.
MIT License
1.88k stars 93 forks source link

preview path may be wrong for edited images #686

Open RhetTbull opened 2 years ago

RhetTbull commented 2 years ago

If image is edited, PhotoInfo.path_derivatives may return the wrong preview image which will result in --preview exporting the wrong image. path_derivatives sorts previews by size and --preview uses the largest preview available. However, in case of edited image, the edited preview may not be the largest.

In this example, the edited preview is the second one in the list:

['/Users/rhet/Pictures/Photos Library.photoslibrary/resources/derivatives/0/018D457F-9F6B-4B2D-AEF2-212A7302D243_1_102_o.jpeg', 
'/Users/rhet/Pictures/Photos Library.photoslibrary/resources/derivatives/0/018D457F-9F6B-4B2D-AEF2-212A7302D243_1_105_c.jpeg', 
'/Users/rhet/Pictures/Photos Library.photoslibrary/resources/derivatives/masters/0/018D457F-9F6B-4B2D-AEF2-212A7302D243_4_5005_c.jpeg']

The same list of images exists for an unedited preview:

['/Users/rhet/Pictures/Photos Library.photoslibrary/resources/derivatives/1/18CA3024-37BB-42D4-B2D6-404A5C9C9406_1_102_o.jpeg', 
'/Users/rhet/Pictures/Photos Library.photoslibrary/resources/derivatives/1/18CA3024-37BB-42D4-B2D6-404A5C9C9406_1_105_c.jpeg', 
'/Users/rhet/Pictures/Photos Library.photoslibrary/resources/derivatives/masters/1/18CA3024-37BB-42D4-B2D6-404A5C9C9406_4_5005_c.jpeg']
RhetTbull commented 2 years ago

See details on previews at #50

Also, wondering if for edited images, the 1_105_c.jpeg is always the right version?