This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" use osxphotos to force the download of photos from iCloud | |
downloads images to a temporary directory then deletes them | |
resulting in the photo being downloaded to Photos library | |
""" | |
import os | |
import sys | |
import tempfile | |
import osxphotos |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import csv | |
import os.path | |
import sqlite3 | |
import sys | |
def get_tables(cursor): | |
cursor.execute("select name from sqlite_master") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" Convert RAW image file (or really any image CoreImage understands) to JPEG on Mac with Python """ | |
# reference: https://stackoverflow.com/questions/59330149/coreimage-ciimage-write-jpg-is-shifting-colors-macos/59334308#59334308 | |
import pathlib | |
# needed to capture system-level stderr | |
from wurlitzer import pipes | |
import Metal | |
import Quartz |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" Extract text from images in Photos.app using tesseract and | |
update Photo description with extracted text """ | |
# NOTE: doesn't currently work well as OCR image needs more pre-processing | |
# see: https://towardsdatascience.com/optical-character-recognition-ocr-with-less-than-12-lines-of-code-using-python-48404218cccb | |
import datetime | |
import pathlib | |
import osxphotos |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" Copy a file with callback (E.g. update a progress bar) """ | |
# based on flutefreak7's answer at StackOverflow | |
# https://stackoverflow.com/questions/29967487/get-progress-back-from-shutil-file-copy-thread/48450305#48450305 | |
# License: MIT License | |
import os | |
import pathlib | |
import shutil |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" Create and mount a temporary disk image on MacOS """ | |
import pathlib | |
import platform | |
import subprocess | |
import tempfile | |
import time | |
class TempDiskImage: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" Use Apple's Vision Framework via PyObjC to detect text in images | |
To use: | |
python3 -m pip install pyobjc-core pyobjc-framework-Quartz pyobjc-framework-Vision wurlitzer | |
""" | |
import pathlib |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Proof of concept showing how to merge Apple Photos libraries including most of the metadata """ | |
# Currently working: | |
# * places photos into correct albums and folder structure | |
# * sets title, description, keywords, location | |
# Limitations: | |
# * doesn't currently handle Live Photos or RAW+JPEG pairs | |
# * only merges the most recent version of the photo (edit history is lost) | |
# * very limited error handling | |
# * doesn't merge Person In Image |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" Read adjustments data for photos edited in Apple's Photos.app | |
In Catalina and Big Sur, the adjustments data (data about edits done to the photo) | |
is stored in a plist file in | |
~/Pictures/Photos Library.photoslibrary/resources/renders/X/UUID.plist | |
where X is first character of the photo's UUID string and UUID is the full UUID, | |
e.g.: ~/Pictures/Photos Library.photoslibrary/resources/renders/3/30362C1D-192F-4CCD-9A2A-968F436DC0DE.plist | |
Thanks to @neilpa who figured out how to decode this information: | |
Reference: https://github.com/neilpa/photohack/issues/4 | |
""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension | UTI | preferred_extension | MIME_type | |
---|---|---|---|---|
c | public.c-source | c | None | |
f | public.fortran-source | f | None | |
h | public.c-header | h | None | |
i | public.c-source.preprocessed | i | None | |
l | public.lex-source | l | None | |
m | public.objective-c-source | m | None | |
o | public.object-code | o | None | |
r | com.apple.rez-source | r | None | |
s | public.assembly-source | s | None |