OSXPhotos provides the ability to interact with and query Apple's Photos.app library on macOS and Linux. You can query the Photos library database — 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. OSXPhotos also works with iPhoto libraries though some features are available only for Photos.
<p align="center"><img src="docs/screencast/demo.gif?raw=true" width="713" height="430"/></p>Tested on Ubuntu Linux and macOS. Many features are only available on macOS.
On Linux, macOS-specific features of the CLI will not be available (these will not be shown in the help output). The export and query CLI commands as well as the Python API will work on Linux which enables you to export photos from a Photos library on a Linux machine.
Tested on macOS Sierra (10.12.6) through macOS Sonoma (14.1). Tested on both x86 and Apple silicon (M1).
OSXPhotos has been minimally tested with macOS Sequoia (15 beta) but new beta versions may break osxphotos support. If you encounter problems with macOS 15.0, please open an issue.
macOS Version | macOS name | Photos.app version |
---|---|---|
15.0 beta | Sequoia | 10.0 (beta support) |
14.0 - 14.6 | Sonoma | 9.0 ✅ |
13.0 - 13.6 | Ventura | 8.0 ✅ |
12.0 - 12.7 | Monterey | 7.0 ✅ |
10.16, 11.0-11.7 | Big Sur | 6.0 ✅ |
10.15.1 - 10.15.7 | Catalina | 5.0 ✅ |
10.14.5, 10.14.6 | Mojave | 4.0 ✅ |
10.13.6 | High Sierra | 3.0 ✅ |
10.12.6 | Sierra | 2.0 ✅ |
Limited support is also provided for exporting photos and metadata from iPhoto libraries. Only iPhoto 9.6.1 (the final release) has been tested.
This package will read Photos databases for any supported version on any supported macOS version. E.g. you can read a database created with Photos 5.0 on MacOS 10.15 on a machine running macOS 10.12 and vice versa.
Requires python >= 3.9
, <= 3.12
. Reading iPhoto libraries requires python >= 3.10
.
For macOS 15.0 / Sequoia developer preview, alpha support is provided (very preliminary, not guaranteed to work). Not all features of osxphotos have been tested and some features may not work. If you encounter issues, please open an issue on GitHub.
If you are new to python, I recommend you install osxphotos using pipx. See other options below. If installing on Linux, see instructions below.
If you aren't familiar with installing python applications, I recommend you install osxphotos
with pipx. The easiest way to do this on a Mac is to use homebrew:
Terminal
(search for Terminal
in Spotlight or look in Applications/Utilities
)homebrew
according to instructions at https://brew.sh/brew install pipx
pipx ensurepath
pipx install osxphotos
osxphotos
by typing: osxphotos
Once you've installed osxphotos with pipx, to upgrade to the latest version:
pipx upgrade osxphotos
[!NOTE] When installing other packages with homebrew, homebrew may update the version of Python installed which would then cause any app (including osxphotos) installed with
pipx
to fail. If this happens, the easiest fix is to reinstall osxphotos with:pipx reinstall osxphotos
Alternatively, you can reinstall all apps installed with
pipx
with:pipx reinstall-all
You can also install directly from pypi:
python3 -m pip install osxphotos
Once you've installed osxphotos with pip, to upgrade to the latest version:
python3 -m pip install --upgrade osxphotos
If you use the MacPorts package manager on a Mac:
sudo port install osxphotos
At least one of the Linux-specific python packages normally installed on Linux may cause an error during installation with pip
or pipx
. If you encounter an error similar to: pip._vendor.packaging.version.InvalidVersion: Invalid version: '6.5.0-1022-generic
, you should still be able to install osxphotos by creating and activating a virtual environment:
python3 -m venv .venv-osxphotos source .venv-osxphotos/bin/activate python3 -m pip install osxphotos
To use osxphotos you will need to ensure the venv is activated using source .venv-osxphotos/bin/activate
.
You may name the virtual environment anything you want; .venv-osxphotos
is used in this example to make it clear the virtual environment is used by osxphotos and to avoid conflict with other virtual environments which, by convention, are often named .venv
or venv
.
If you want to work on osxphotos code or contribute to the project, you can install from the git repository:
git clone https://github.com/RhetTbull/osxphotos.git
cd osxphotos
[!NOTE] The git repo for this project is very large (> 3GB) because it contains multiple Photos libraries used for testing on different versions of macOS.
If you just want to use the osxphotos package in your own code, I recommend you install the latest version from PyPI which does not include all the test libraries. If you just want to use the command line utility, you can download a pre-built executable of the latest release or you can install via
pip
which also installs the command line app. If you aren't comfortable with running python on your Mac, start with the pre-built executable orpipx
as described above.Alternatively, to clone the repository without the test data:
git clone --filter=blob:none --no-checkout --sparse https://github.com/RhetTbull/osxphotos.git cd osxphotos git sparse-checkout set --no-cone '/*' '!tests' git checkout
Next, install the required dependencies, and osxphotos
itself. I recommend you create a
virtual environment before installing osxphotos.
python3 -m pip install -r dev_requirements.txt
python3 -m pip install -r requirements.txt
python3 -m pip install -e .
Once you've installed osxphotos via the git repository, to upgrade to the latest version:
cd osxphotos
git pull
python3 -m pip install -e .
See also the developer notes in README_DEV.md.
You can also download a stand-alone pre-built executable--that doesn't require installing python--from the releases page. Look for the file with a name similar to osxphotos_MacOS_exe_darwin_x86_64_v0.63.5.zip
. In this case v0.63.5
specifies version 0.63.5 and x86_64
specifies Intel x86 platform; you should download the latest version available. For Apple Silicon, there is an equivalent arm64
version of the executable. Unzip the file and put the included osxphotos
binary in your system path. Currently, the binary is not notarized so you'll have to authorize the app to run in the System Preferences | Security & Privacy settings. If you don't know how to do this, I recommend using pipx
as described above.
See the documentation for more information on using osxphotos.
OSXPhotos is well documented. See the tutorial for a description of key features. The tutorial can be accessed using the command osxphotos tutorial
via the command line. If you are interested in using OSXPhotos in your own code, see API_README.md for a description of the API as well as the example programs. The full documentation is available online and can also be accessed using the command osxphotos docs
via the command line. Running osxphotos help
will show help in the terminal. You can use osxphotos help COMMAND
to get help on a command. For example, osxphotos help export
. To search within the help of a specific command, use osxphotos help COMMAND TOPIC
, for example, osxphotos help export sidecar
.
If you have questions, would like to show off projects created with OSXPhotos, or if you just want to say hello, please use the GitHub discussions forum or the osxphotos subreddit on Reddit.
This package will install a command line utility called osxphotos
that allows you to query the Photos database. Alternatively, you can also run the command line utility like this: python3 -m osxphotos
Usage: osxphotos [OPTIONS] COMMAND [ARGS]...
OSXPhotos: the multi-tool for your Photos library.
To get help on a specific command, use "osxphotos COMMAND --help" or
"osxphotos help COMMAND"; for example, "osxphotos help export".
To search help for a specific topic within a command, run "osxphotos help
COMMAND TOPIC"; for example, "osxphotos help export keyword" to get help
related to keywords when using the export command.
To see the full documentation in your browser, run "osxphotos docs".
Some advanced commands are hidden by default. To see all commands, run
"OSXPHOTOS_SHOW_HIDDEN=1 osxphotos help". Some commands also have hidden
options. These can be seen by running "OSXPHOTOS_SHOW_HIDDEN=1 osxphotos help
COMMAND".
Options:
-v, --version Show the version and exit.
-h, --help Show this message and exit.
Commands:
about Print information about osxphotos including license.
add-locations Add missing location data to photos in Photos.app using...
albums Print out albums found in the Photos library.
batch-edit Batch edit photo metadata such as title, description,...
compare Compare two Photos libraries to find differences
docs Open osxphotos documentation in your browser.
dump Print list of all photos & associated info from the Photos...
exiftool Run exiftool on previously exported files to update metadata.
export Export photos from the Photos database.
exportdb Utilities for working with the osxphotos export database
help Print help; for help on commands: help <command>.
import Import photos and videos into Photos.
info Print out descriptive info of the Photos library database.
inspect Interactively inspect photos selected in Photos.
install Install Python packages into the same environment as...
keywords Print out keywords found in the Photos library.
labels Print out image classification labels found in the Photos...
list Print list of Photos libraries found on the system.
orphans Find orphaned photos in a Photos library
persons Print out persons (faces) found in the Photos library.
places Print out places found in the Photos library.
push-exif Write photo metadata to original files in the Photos library
query Query the Photos database using 1 or more search options;...
repl Run interactive osxphotos REPL shell (useful for...
run Run a python file using same environment as osxphotos.
show Show photo, album, or folder in Photos from UUID_OR_NAME
sync Sync metadata and albums between Photos libraries.
template Interactively render templates for selected photo.
theme Manage osxphotos color themes.
timewarp Adjust date/time/timezone of photos in Apple Photos.
tutorial Display osxphotos tutorial.
uninstall Uninstall Python packages from the osxphotos environment
uuid Print out unique IDs (UUID) of photos selected in Photos
version Check for new version of osxphotos.
<!--[[[end]]] -->
To get help on a specific command, use osxphotos help COMMAND
, for example, osxphotos help export
to get help on the export
command.
Some of the commands such as export
and query
have a large number of options. To search for options related to a specific topic, you can use osxphotos help COMMAND TOPIC
. For example, osxphotos help export raw
finds the options related to RAW files (search is case-insensitive):
Usage: osxphotos export [OPTIONS] ... DEST
Export photos from the Photos database. Export path DEST is required.
Optionally, query the Photos database using 1 or more search options; if
more than one option is provided, they are treated as "AND" (e.g. search for
photos matching all options). If no query options are provided, all photos
will be exported. By default, all versions of all photos will be exported
including edited versions, live photo movies, burst photos, and associated
raw images. See --skip-edited, --skip-live, --skip-bursts, and --skip-raw
options to modify this behavior.
Options that match 'raw':
--has-raw Search for photos with both a jpeg and
raw version
--skip-raw Do not export associated RAW image of a
RAW+JPEG pair. Note: this does not skip RAW
photos if the RAW photo does not have an
associated JPEG image (e.g. the RAW file was
imported to Photos without a JPEG preview).
--convert-to-jpeg Convert all non-JPEG images (e.g. RAW, HEIC,
PNG, etc) to JPEG upon export. Note: does not
convert the RAW component of a RAW+JPEG pair as
the associated JPEG image will be exported. You
can use --skip-raw to skip
exporting the associated RAW image of a
RAW+JPEG pair. See also --jpeg-quality and
--jpeg-ext. Only works if your Mac has a GPU
(thus may not work on virtual machines).
AI辅助编程,代码自动修复
Trae是一种自适应的集成开发环境(IDE),通过自动化和多元协作改变开发流程。利用Trae,团队能够更快速、精确地编写和部署代码,从而提高编程效率和项目交付速度。Trae具备上下文感知和代码自动完成功能,是提升开发效率的理想工具。
AI小说写作助手,一站式润色、改写、扩写
蛙蛙写作—国内先进的AI写作平台,涵盖小说、学术、社交媒体等多场景。提供续写、改写、润色等功能,助力创作者高效优化写作流程。界面简洁,功能全面,适合各类写作者提升内容品质和工作效率。
全能AI智能助手,随时解答生活与工作的多样问题
问小白,由元石科技研发的AI智能助手,快 速准确地解答各种生活和工作问题,包括但不限于搜索、规划和社交互动,帮助用户在日常生活中提高效率,轻松管理个人事务。
实时语音翻译/同声传译工具
Transly是一个多场景的AI大语言模型驱动的同声传译、专业翻译助手,它拥有超精准的音频识别翻译能力,几乎零延迟的使用体验和支持多国语言可以让你带它走遍全球,无论你是留学 生、商务人士、韩剧美剧爱好者,还是出国游玩、多国会议、跨国追星等等,都可以满足你所有需要同传的场景需求,线上线下通用,扫除语言障碍,让全世界的语言交流不再有国界。
一键生成PPT和Word,让学习生活更轻松
讯飞智文是一个利用 AI 技术的项目,能够帮助用户生成 PPT 以及各类文档。无论是商业领域的市场分析报告、年度目标制定,还是学生群体的职业生涯规划、实习避坑指南,亦或是活动策划、旅游攻略等内容,它都能提供支持,帮助用户精准表达,轻松呈现各种信息。
深度推理能力全新升级,全面对标OpenAI o1
科大讯飞的星火大模型,支持语言理解、知识问答和文本创作等多功能,适用于多种文件和业务场景,提升办公和日常生活的效率。 讯飞星火是一个提供丰富智能服务的平台,涵盖科技资讯、图像创作、写作辅助、编程解答、科研文献解读等功能,能为不同需求的用户提供便捷高效的帮助,助力用户轻松获取信息、解决问题,满足多样化使用场景。
一种基于大语言模型的高效单流解耦语音令牌文本到语音合成模型
Spark-TTS 是一个基于 PyTorch 的开源文本到语音合成项目,由多个知名机构联合参与。该项目提供了高效的 LLM(大语言模型)驱动的语音合成方案,支持语音克隆和语音创建功能,可通过命令行界面(CLI)和 Web UI 两种方式使用。用户可以根据需求调整语音的性别、音高、速度等参数,生成高质量的语音。该项目适用于多种场景,如有声读物制作、智能语音助手开发等。
AI助力,做PPT更简单!
咔片是一款轻量化在线演示设 计工具,借助 AI 技术,实现从内容生成到智能设计的一站式 PPT 制作服务。支持多种文档格式导入生成 PPT,提供海量模板、智能美化、素材替换等功能,适用于销售、教师、学生等各类人群,能高效制作出高品质 PPT,满足不同场景演示需求。
选题、配图、成文,一站式创作,让内容运营更高效
讯飞绘文,一个AI集成平台,支持写作、选题、配图、排版和发布。高效生成适用于各类媒体的定制内容,加速品牌传播,提升内容营销效果。
专业的AI公文写作平台,公文写作神器
AI 材料星,专业的 AI 公文写作辅助平台,为体制内工作人员提供高效的公文写作解决方案。拥有海量公文文库、9 大核心 AI 功能,支持 30 + 文稿类型生成,助力快速完成领导讲话、工作总结、述职报告等材料 ,提升办公效率,是体制打工人的得力写作神器。
最新AI工具、AI资讯
独家AI资源、AI项目落地
微信扫一扫关注公众号