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
2.04k stars 96 forks source link

generating preview for edited photos #560

Open spencerc99 opened 2 years ago

spencerc99 commented 2 years ago

Describe the bug I sometimes can't get a preview to produce and seems consistent for edited images (previously ran into here https://github.com/RhetTbull/osxphotos/issues/526#issuecomment-945943560). Is there any way to force it to generate a preview for an image edited on a different device?

Also, tangential but I seem to be getting duplicate exports for certain photos despite using the --update option.

To Reproduce Steps to reproduce the behavior: here's my full command

osxphotos export --download-missing --album fits\ 🧢 --use-photokit --skip-live --skip-original-if-edited --filename "{created.date}:{original_name}" --update --convert-to-jpeg --post-function scripts/transform_exported_fits_into_db.py::post_function --preview ./fits-export

Expected behavior preview to be generated with the preview flag

RhetTbull commented 2 years ago

The preview files are generated by Photos, not osxphotos. The --preview flag instructs osxphotos to export the preview image stored in Photos (if one exists). In most cases, a preview image exists but in some cases, Photos might not yet have generated one (for example, if the photo was edited on another device and the changes were not yet synched to the local library). In these cases, osxphotos cannot export the preview. You could use something like imagemagick and post-function to generate a preview for exported photos that are missing one.

As to the unexpected duplicates, this shouldn't happen so if it is, it's a bug. If you run your export command with --verbose it'll print out extra information that might be useful for debugging this. For example, run with --verbose then find a duplicate export and find all references to that image in the verbose output. Without some additional info I'm afraid I can't debug this.