pibooth-gallery
A plugin for pibooth that, after each final picture is saved:
- creates a thumbnail,
- creates/updates a
thumbs.jsonmanifest next to the pictures (newest first, with an optional QR code entry), - optionally copies a static gallery HTML template beside the pictures as
gallery.html.
It is designed to work with pibooth-rclone-upload (uploads the picture folder to a web host or S3) and my fork of pibooth-qrcode.
Together they give you a workflow where:
- Final images are uploaded to a website or S3 bucket and are viewable in a browser.
- QR codes are created and uploaded with each image, enabling direct download.
- A web gallery lets guests scroll through all uploaded images for an event.
Optionally, gallery-protect is a Cloudflare worker that password-protects the gallery so only people with the password can view/download images.
Installation
Requires Python 3.7+, pibooth and Pillow (both installed automatically by pip).
The plugin must be installed into the same Python environment that pibooth runs from. pibooth discovers it automatically through its pibooth entry point, so no extra configuration is needed to load it.
Raspberry Pi OS Bookworm / Trixie (virtual environment)
Since Bookworm, Raspberry Pi OS marks the system Python as "externally managed" (PEP 668), so pip install outside a virtual environment fails with error: externally-managed-environment. Do not work around this with --break-system-packages; install into the virtual environment that pibooth uses instead.
-
Activate the virtual environment pibooth is installed in. Use whatever path you created it at;
~/venvis used here as an example:source ~/venv/bin/activate
Your prompt should now start with
(venv). To check that this is the right environment,pip show piboothshould print pibooth's details.If you have not set up pibooth yet, create the environment first.
--system-site-packageslets it use the Raspberry Pi camera libraries (picamera2) installed by apt:python3 -m venv --system-site-packages ~/venv source ~/venv/bin/activate pip install pibooth
-
Install the plugin from PyPI:
pip install pibooth-gallery
-
Check that pibooth sees it:
pibooth --diagnosticor start pibooth and look for
pibooth_galleryin the loaded plugins list in the log.
To upgrade later (with the environment activated):
pip install --upgrade pibooth-gallery
If pibooth is launched automatically (autostart, systemd, cron), make sure the launcher uses the venv's interpreter, e.g. ~/venv/bin/pibooth, otherwise the plugin will not be found.
Other systems
pip install pibooth-gallery
(inside a virtual environment, or on a system where pip is not externally managed).
From source
git clone https://github.com/peteoheat/pibooth-gallery.git
pip install ./pibooth-gallery
Gallery HTML templates
The HTML templates (plain_gallery_template.html, seasonal_snowflake_gallery_auto_update_template.html, candy_cane_lane_gallery.html) are not installed into Python's site-packages. Download the one you want from the GitHub repository, edit the event-specific values in it (e.g. IMAGE_HOST_BASE, titles), and point template at it in pibooth.cfg.
Configuration
After the first run, pibooth adds a [GALLERY] section to ~/.config/pibooth/pibooth.cfg (you can also edit it with pibooth --config). Option names are lower case; there is no "enable" option. To disable the plugin, list pibooth_gallery in [GENERAL] plugins_disabled.
[GALLERY]
size = 300x300
suffix = _thumb
quality = 85
output_folder =
keep_aspect = True
update_manifest = True
manifest_name = thumbs.json
manifest_include_base_url = True
template = /home/pi/gallery_template.html
output = gallery.html
base_url = https://example.com/event123/
| Option | Default | Description |
|---|---|---|
size |
300x300 |
Thumbnail size as WxH. |
suffix |
_thumb |
Suffix appended to the thumbnail filename. |
quality |
85 |
JPEG quality for thumbnails. |
output_folder |
(empty) | Optional subfolder for thumbnails. Leave empty when using pibooth-rclone-upload, which does not upload subfolders. |
keep_aspect |
True |
Keep the aspect ratio when resizing. |
update_manifest |
True |
Create/update the manifest after each picture. |
manifest_name |
thumbs.json |
Manifest filename, written next to the pictures. |
manifest_include_base_url |
True |
Prefix manifest entries with base_url. |
template |
(empty) | Optional path to a gallery HTML template to copy beside the pictures. |
output |
gallery.html |
Filename for the copied template. |
base_url |
(empty) | Base URL for manifest entries. Falls back to [DOWNLOADER] base_url. |
QR code integration
This plugin never adds or modifies [QRCODE] settings. To find a picture's QR code it uses, in order:
- the
qrcode_pathrecorded in pibooth's picture metadata, then <picture name><suffix>.<ext>(from[QRCODE]suffix/ext, default_qrcode/png), searched in[QRCODE]save_path, the[GENERAL]directoryentries, then the picture's own folder.
The QR image is already on disk when this plugin runs, so no waiting is needed.
How it works
- pibooth saves the final picture.
- On leaving the processing state, pibooth-gallery (running before other plugins, so uploaders see its output):
- creates the thumbnail,
- sets
previous_thumbnail_fileon the pibooth app for other plugins, - updates or creates
thumbs.json, - optionally writes
gallery.htmlfrom the template.
- All files are written atomically, so an uploader never sees a partial file. A corrupt manifest is moved to
thumbs.json.bakrather than overwritten. Errors are logged and never interrupt pibooth.
Manifest format
thumbs.json is a list, newest first:
[
{
"thumb": "IMG_001_thumb.jpg",
"full": "IMG_001.jpg",
"filename": "IMG_001.jpg",
"qrcode": "IMG_001_qrcode.png"
}
]
With manifest_include_base_url = True and a base_url, thumb, full and qrcode become absolute URLs such as https://example.com/event123/IMG_001.jpg.
Publishing to PyPI (maintainers)
The package version comes from __version__ in pibooth_gallery.py.
# 1. bump __version__ in pibooth_gallery.py, commit and tag
python -m pip install --upgrade build twine
python -m build # creates dist/*.tar.gz and dist/*.whl
python -m twine check dist/*
# 2. optional dry run on TestPyPI
python -m twine upload --repository testpypi dist/*
# 3. publish (use a PyPI API token: username __token__)
python -m twine upload dist/*
PyPI never allows a version to be re-uploaded, so bump the version for every release.
Contributing
Pull requests are welcome. Please open an issue for feature requests or bug reports.
License
MIT, see LICENSE.
Metadata
Release files for pibooth-gallery 1.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| pibooth_gallery-1.3.0.tar.gz | 26.7 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pibooth_gallery-1.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 37.2 kB
Release files / pibooth_gallery-1.3.0.tar.gz
| Download URL | pibooth_gallery-1.3.0.tar.gz |
|---|---|
| Size | 26.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a5a04d0e360fc7bed8a58ed151a380b1841c93724287b0029390d59d15fb37b1
|
|
BLAKE2b-256 checksum How to use checksums |
70d82c9d38808268d350e3a2c4dbde0d75c895d3853f45a6cc3cbf458dec218e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.15.0
|
Release files / pibooth_gallery-1.3.0-py3-none-any.whl
| Download URL | pibooth_gallery-1.3.0-py3-none-any.whl |
|---|---|
| Size | 10.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a26e7893edca5ab03ad695b7de1908bb38efe67426ff7c1825e491b3cb539b63
|
|
BLAKE2b-256 checksum How to use checksums |
7be416bc32834cb7b2b0f8734bdd2fb8e25f75ba9d1a1f5075794f5061cf37e7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.15.0
|
Security for pibooth-gallery 1.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.