From a22485afda0a37ac1074f5bfea10828c8fef3151 Mon Sep 17 00:00:00 2001 From: Shyam Sunder Date: Mon, 7 Feb 2022 12:51:25 -0500 Subject: [PATCH] server/func/images: upgrade to heif-image-plugin --- server/Dockerfile | 2 +- server/requirements.txt | 18 +++++++++--------- server/szurubooru/func/image_hash.py | 5 +---- server/szurubooru/func/images.py | 2 ++ 4 files changed, 13 insertions(+), 14 deletions(-) diff --git a/server/Dockerfile b/server/Dockerfile index 205c8e4c..aac0a652 100644 --- a/server/Dockerfile +++ b/server/Dockerfile @@ -28,9 +28,9 @@ RUN apk --no-cache add \ && pip3 install --no-cache-dir --disable-pip-version-check \ alembic \ "coloredlogs==5.0" \ + heif-image-plugin \ youtube_dl \ pillow-avif-plugin \ - pyheif-pillow-opener \ && apk --no-cache del py3-pip COPY ./ /opt/app/ diff --git a/server/requirements.txt b/server/requirements.txt index 2a09b24b..6b032d35 100644 --- a/server/requirements.txt +++ b/server/requirements.txt @@ -1,14 +1,14 @@ alembic>=0.8.5 -pyyaml>=3.11 -psycopg2-binary>=2.6.1 -SQLAlchemy>=1.0.12, <1.4 -coloredlogs==5.0 certifi>=2017.11.5 +coloredlogs==5.0 +heif-image-plugin>=0.3.2 numpy>=1.8.2 -pillow>=4.3.0 -pynacl>=1.2.1 -pytz>=2018.3 -pyRFC3339>=1.0 pillow-avif-plugin>=1.1.0 -pyheif-pillow-opener>=0.1.0 +pillow>=4.3.0 +psycopg2-binary>=2.6.1 +pynacl>=1.2.1 +pyRFC3339>=1.0 +pytz>=2018.3 +pyyaml>=3.11 +SQLAlchemy>=1.0.12, <1.4 youtube_dl diff --git a/server/szurubooru/func/image_hash.py b/server/szurubooru/func/image_hash.py index 05b27a42..76d5a846 100644 --- a/server/szurubooru/func/image_hash.py +++ b/server/szurubooru/func/image_hash.py @@ -4,16 +4,13 @@ from datetime import datetime from io import BytesIO from typing import Any, Callable, List, Optional, Set, Tuple +import HeifImagePlugin import numpy as np import pillow_avif -import pyheif from PIL import Image -from pyheif_pillow_opener import register_heif_opener from szurubooru import config, errors -register_heif_opener() - logger = logging.getLogger(__name__) # Math based on paper from H. Chi Wong, Marshall Bern and David Goldberg diff --git a/server/szurubooru/func/images.py b/server/szurubooru/func/images.py index 4d4011fe..e135d182 100644 --- a/server/szurubooru/func/images.py +++ b/server/szurubooru/func/images.py @@ -7,6 +7,8 @@ import subprocess from io import BytesIO from typing import List +import HeifImagePlugin +import pillow_avif from PIL import Image as PILImage from szurubooru import errors