From 659f351c65237ce0a30319dacc6ad127308cc09f Mon Sep 17 00:00:00 2001 From: ed Date: Thu, 14 Aug 2025 16:42:48 +0000 Subject: [PATCH] support pillow-heif; closes #607 --- README.md | 4 ++-- copyparty/th_srv.py | 5 ++++- docs/devnotes.md | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index b3a2d134..c8520202 100644 --- a/README.md +++ b/README.md @@ -2793,7 +2793,7 @@ enable [music tags](#metadata-from-audio-files): enable [thumbnails](#thumbnails) of... * **images:** `Pillow` and/or `pyvips` and/or `ffmpeg` (requires py2.7 or py3.5+) * **videos/audio:** `ffmpeg` and `ffprobe` somewhere in `$PATH` -* **HEIF pictures:** `pyvips` or `ffmpeg` or `pyheif-pillow-opener` (requires Linux or a C compiler) +* **HEIF pictures:** `pyvips` or `ffmpeg` or `pillow-heif` * **AVIF pictures:** `pyvips` or `ffmpeg` or `pillow-avif-plugin` or pillow v11.3+ * **JPEG XL pictures:** `pyvips` or `ffmpeg` * **RAW images:** `rawpy`, plus one of `pyvips` or `Pillow` (for some formats) @@ -2827,7 +2827,7 @@ set any of the following environment variables to disable its associated optiona | `PRTY_NO_PIL` | disable all [Pillow](https://pypi.org/project/pillow/)-based thumbnail support; will fallback to libvips or ffmpeg | | `PRTY_NO_PILF` | disable Pillow `ImageFont` text rendering, used for folder thumbnails | | `PRTY_NO_PIL_AVIF` | disable Pillow avif support (internal and/or [plugin](https://pypi.org/project/pillow-avif-plugin/)) | -| `PRTY_NO_PIL_HEIF` | disable 3rd-party Pillow plugin for [HEIF support](https://pypi.org/project/pyheif-pillow-opener/) | +| `PRTY_NO_PIL_HEIF` | disable 3rd-party Pillow plugin for [HEIF support](https://pypi.org/project/pillow-heif/) | | `PRTY_NO_PIL_WEBP` | disable use of native webp support in Pillow | | `PRTY_NO_PSUTIL` | do not use [psutil](https://pypi.org/project/psutil/) for reaping stuck hooks and plugins on Windows | | `PRTY_NO_RAW` | disable all [rawpy](https://pypi.org/project/rawpy/)-based thumbnail support for RAW images | diff --git a/copyparty/th_srv.py b/copyparty/th_srv.py index 945c6d56..537c748a 100644 --- a/copyparty/th_srv.py +++ b/copyparty/th_srv.py @@ -86,7 +86,10 @@ try: if os.environ.get("PRTY_NO_PIL_HEIF"): raise Exception() - from pyheif_pillow_opener import register_heif_opener + try: + from pillow_heif import register_heif_opener + except ImportError: + from pyheif_pillow_opener import register_heif_opener register_heif_opener() HAVE_HEIF = True diff --git a/docs/devnotes.md b/docs/devnotes.md index 9fbb29df..e2fcc008 100644 --- a/docs/devnotes.md +++ b/docs/devnotes.md @@ -354,7 +354,7 @@ pip install mutagen # audio metadata pip install pyftpdlib # ftp server pip install partftpy # tftp server pip install impacket # smb server -- disable Windows Defender if you REALLY need this on windows -pip install Pillow pyheif-pillow-opener # thumbnails +pip install Pillow pillow-heif # thumbnails pip install pyvips # faster thumbnails pip install psutil # better cleanup of stuck metadata parsers on windows pip install black==21.12b0 click==8.0.2 bandit pylint flake8 isort mypy # vscode tooling