A script that downloads images in original quality from a given immich album
Find a file
2025-04-12 01:01:09 +02:00
.env.template initial commit 2025-04-10 15:21:51 +02:00
.gitignore add .idea to gitignore 2025-04-10 15:28:49 +02:00
LICENSE add license 2025-04-10 15:22:19 +02:00
main.py add readme 2025-04-10 15:28:31 +02:00
README.md Aggiorna README.md 2025-04-12 01:01:09 +02:00

Immich Album Downloader

This Python script downloads all assets (photos/videos) from a specific album in your Immich instance, using its API. It supports resuming by skipping files that already exist locally.

Features

  • Downloads all assets from a specified album
  • Uses pagination to handle large albums
  • Skips already-downloaded files
  • Can be automated with systemd services and timers

Requirements

You can install dependencies with:

pip install requests

or you can use your system's package manager.

Environment Variables

Variable Description
IMMICH_API_KEY Your Immich API key
IMMICH_INSTANCE_URL Immich instance URL (e.g. https://your-instance/api)
IMMICH_ALBUM_ID The ID of the album to download
IMMICH_DOWNLOAD_PATH Directory to save downloaded assets

Configuration

  1. Copy the files:
git clone https://git.marcorealacci.me/marcorealacci/immich-album-downloader.git
sudo mkdir /opt/immich-album-downloader
sudo cp main.py /opt/immich-album-downloader/main.py
sudo cp .env.template /opt/immich-album-downloader/.env
  1. Modify /opt/immich-album-downloader/.env accordingly

Running the script automatically

Create a service file at /etc/systemd/user/immich-album-downloader.service:

[Unit]
Description=Immich Album Downloader
After=network.target

[Service]
Type=simple
EnvironmentFile=/opt/immich-album-downloader/.env
ExecStart=/usr/bin/python3 /opt/immich-album-downloader/main.py
Restart=no

[Install]
WantedBy=default.target

Enable and start the service (only if you don't configure the timer below):

systemctl --user daemon-reload
systemctl --user enable --now immich-album-downloader.service

Running the script periodically

To run the download periodically, create /etc/systemd/user/immich-album-downloader.timer:

[Unit]
Description=Download an Immich album periodically

[Timer]
OnBootSec=15m
OnUnitActiveSec=6h

[Install]
WantedBy=timers.target

Enable the timer:

systemctl --user enable --now immich-album-downloader.timer

This will trigger the album download 15 minutes after boot and then every 6 hours.