Skip to main content

Add support for HEIC images in srgbify.py

ID
f74c611
date
2023-11-22 21:25:10+00:00
author
Alex Chan <alex@alexwlchan.net>
parent
5c04ed1
message
Add support for HEIC images in srgbify.py

See https://stackoverflow.com/a/69988418/1558022
changed files
3 files, 10 additions, 1 deletion

Changed files

images/srgbify.py (1194) → images/srgbify.py (1264)

diff --git a/images/srgbify.py b/images/srgbify.py
index 0814224..1bbcb31 100755
--- a/images/srgbify.py
+++ b/images/srgbify.py
@@ -13,6 +13,10 @@ import sys
 import tempfile
 
 from PIL import Image, ImageCms
+from pillow_heif import register_heif_opener
+
+
+register_heif_opener()
 
 
 if __name__ == "__main__":

requirements.in (58) → requirements.in (70)

diff --git a/requirements.in b/requirements.in
index 0040891..5351b84 100644
--- a/requirements.in
+++ b/requirements.in
@@ -3,5 +3,6 @@ flake8
 hyperlink
 keyring
 Pillow
+pillow_heif
 pip-tools
 termcolor

requirements.txt (1066) → requirements.txt (1159)

diff --git a/requirements.txt b/requirements.txt
index 2813c45..1c2f62c 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -2,7 +2,7 @@
 # This file is autogenerated by pip-compile with Python 3.12
 # by the following command:
 #
-#    pip-compile
+#    pip-compile requirements.in
 #
 black==23.11.0
     # via -r requirements.in
@@ -35,6 +35,10 @@ packaging==23.2
 pathspec==0.11.2
     # via black
 pillow==10.1.0
+    # via
+    #   -r requirements.in
+    #   pillow-heif
+pillow-heif==0.13.1
     # via -r requirements.in
 pip-tools==7.3.0
     # via -r requirements.in