{"id":35122,"date":"2022-02-25T16:08:55","date_gmt":"2022-02-25T21:08:55","guid":{"rendered":"https:\/\/mjtsai.com\/blog\/?p=35122"},"modified":"2022-02-25T16:08:55","modified_gmt":"2022-02-25T21:08:55","slug":"osxphotos-python-tool","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2022\/02\/25\/osxphotos-python-tool\/","title":{"rendered":"OSXPhotos Python Tool"},"content":{"rendered":"<p><a href=\"https:\/\/github.com\/RhetTbull\/osxphotos\">Rhet Turnbull<\/a> (via <a href=\"https:\/\/twitter.com\/arltst\/status\/1495500171941138448\">Stephan Arlt<\/a>):<\/p>\n<blockquote cite=\"https:\/\/github.com\/RhetTbull\/osxphotos\"><p>OSXPhotos provides the ability to interact with and query Apple&rsquo;s Photos.app library on macOS. You can query the Photos library database &mdash; for example, file name, file path, and metadata such as keywords\/tags, persons\/faces, albums, etc. You can also easily export both the original and edited photos.<\/p><p>[&#8230;]<\/p><p>If you encounter missing photos you can tell osxphotos to download the missing photos from iCloud using the <code>--download-missing<\/code> option.  <code>--download-missing<\/code> uses AppleScript to communicate with Photos and tell it to download the missing photos.  Photos&rsquo; AppleScript interface is somewhat buggy and you may find that Photos crashes.  In this case, osxphotos will attempt to restart Photos to resume the download process.  There&rsquo;s also an experimental <code>--use-photokit<\/code> option that will communicate with Photos using a different &ldquo;PhotoKit&rdquo; interface.  This option must be used together with <code>--download-missing<\/code>[&#8230;]<\/p>\n<p>[&#8230;]<\/p>\n<p>Photos tracks a tremendous amount of metadata associated with photos in the library such as keywords, faces and persons, reverse geolocation data, and image classification labels. Photos&rsquo; native export capability does not preserve most of this metadata. osxphotos can, however, access and preserve almost all the metadata associated with photos.<\/p><\/blockquote>\n<p>This uses SQLite and reverse engineering rather than the more limited <a href=\"https:\/\/developer.apple.com\/documentation\/photokit\">PhotoKit<\/a>.<\/p>","protected":false},"excerpt":{"rendered":"<p>Rhet Turnbull (via Stephan Arlt): OSXPhotos provides the ability to interact with and query Apple&rsquo;s Photos.app library on macOS. You can query the Photos library database &mdash; for example, file name, file path, and metadata such as keywords\/tags, persons\/faces, albums, etc. You can also easily export both the original and edited photos.[&#8230;]If you encounter missing [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"apple_news_api_created_at":"2022-02-25T21:08:58Z","apple_news_api_id":"d7612dfa-67e1-4c41-a223-81d7ac9ad6e1","apple_news_api_modified_at":"2022-02-25T21:08:58Z","apple_news_api_revision":"AAAAAAAAAAD\/\/\/\/\/\/\/\/\/\/w==","apple_news_api_share_url":"https:\/\/apple.news\/A12Et-mfhTEGiI4HXrJrW4Q","apple_news_coverimage":0,"apple_news_coverimage_caption":"","apple_news_is_hidden":false,"apple_news_is_paid":false,"apple_news_is_preview":false,"apple_news_is_sponsored":false,"apple_news_maturity_rating":"","apple_news_metadata":"\"\"","apple_news_pullquote":"","apple_news_pullquote_position":"","apple_news_slug":"","apple_news_sections":"\"\"","apple_news_suppress_video_url":false,"apple_news_use_image_component":false,"footnotes":""},"categories":[2],"tags":[159,131,1142,30,2077,608,74,927,232,425],"class_list":["post-35122","post","type-post","status-publish","format-standard","hentry","category-technology","tag-applescript","tag-bug","tag-icloud-photo-library","tag-mac","tag-macos-12","tag-metadata","tag-opensource","tag-photos-app","tag-python","tag-sqlite"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/35122","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/comments?post=35122"}],"version-history":[{"count":1,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/35122\/revisions"}],"predecessor-version":[{"id":35123,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/35122\/revisions\/35123"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=35122"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=35122"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=35122"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}