From 2271aecd5c52d5a45b6beee45e183dcf2133cf26 Mon Sep 17 00:00:00 2001 From: wk333 <13474090681@163.com> Date: Mon, 27 May 2024 16:48:16 +0800 Subject: [PATCH] Sync release from 22.03-SP2 --- 0001-added-support-for-webp-files.patch | 28 +++++++++++++++ 0002-fixed-support-for-VP8X.patch | 45 +++++++++++++++++++++++++ 0003-Update-imagesize.py.patch | 38 +++++++++++++++++++++ python-imagesize.spec | 16 +++++++-- 4 files changed, 125 insertions(+), 2 deletions(-) create mode 100644 0001-added-support-for-webp-files.patch create mode 100644 0002-fixed-support-for-VP8X.patch create mode 100644 0003-Update-imagesize.py.patch diff --git a/0001-added-support-for-webp-files.patch b/0001-added-support-for-webp-files.patch new file mode 100644 index 0000000..e03cc48 --- /dev/null +++ b/0001-added-support-for-webp-files.patch @@ -0,0 +1,28 @@ +From b214d05c3899816d7f1f908145461453a6719ad2 Mon Sep 17 00:00:00 2001 +From: ExtReMLapin <3909752+ExtReMLapin@users.noreply.github.com> +Date: Fri, 29 Apr 2022 16:56:31 +0200 +Subject: [PATCH] added support for webp files + +--- + imagesize.py | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/imagesize.py b/imagesize.py +index f700f14..9e1960a 100644 +--- a/imagesize.py ++++ b/imagesize.py +@@ -249,6 +249,11 @@ def get(filepath): + + fhandle.seek(-1, os.SEEK_CUR) + width, height = sizes ++ elif head.startswith(b"RIFF") and head[8:12] == b"WEBP": ++ # enter VP8 chunk ++ fhandle.seek(26) ++ width = struct.unpack(" +Date: Tue, 3 May 2022 17:01:06 +0200 +Subject: [PATCH] fixed support for VP8X + +--- + imagesize.py | 15 ++++++++++----- + 1 file changed, 10 insertions(+), 5 deletions(-) + +diff --git a/imagesize.py b/imagesize.py +index 9e1960a..f4edd1d 100644 +--- a/imagesize.py ++++ b/imagesize.py +@@ -96,7 +96,7 @@ def get(filepath): + fhandle = open(filepath, 'rb') + + try: +- head = fhandle.read(24) ++ head = fhandle.read(31) + size = len(head) + # handle GIFs + if size >= 10 and head[:6] in (b'GIF87a', b'GIF89a'): +@@ -250,10 +250,15 @@ def get(filepath): + fhandle.seek(-1, os.SEEK_CUR) + width, height = sizes + elif head.startswith(b"RIFF") and head[8:12] == b"WEBP": +- # enter VP8 chunk +- fhandle.seek(26) +- width = struct.unpack(" +Date: Tue, 3 May 2022 17:20:07 +0200 +Subject: [PATCH] Update imagesize.py + +--- + imagesize.py | 10 ++++++---- + 1 file changed, 6 insertions(+), 4 deletions(-) + +diff --git a/imagesize.py b/imagesize.py +index f4edd1d..e6ed07e 100644 +--- a/imagesize.py ++++ b/imagesize.py +@@ -250,15 +250,17 @@ def get(filepath): + fhandle.seek(-1, os.SEEK_CUR) + width, height = sizes + elif head.startswith(b"RIFF") and head[8:12] == b"WEBP": +- if head[12:16] == b"VP8L": +- raise ValueError("Invalid WEBP file: Not a WebP file.") +- elif head[12:16] == b"VP8 ": ++ if head[12:16] == b"VP8 ": + width, height = struct.unpack("> 6)) + 1 + else: +- raise ValueError("Invalid WEBP file: Not a WebP file.") ++ raise ValueError("Unsupported WebP file") + + finally: + fhandle.close() +-- +2.39.0.windows.2 + diff --git a/python-imagesize.spec b/python-imagesize.spec index 0d72cbe..80d84a0 100644 --- a/python-imagesize.spec +++ b/python-imagesize.spec @@ -1,10 +1,13 @@ Name: python-imagesize Version: 1.3.0 -Release: 3 +Release: 6 Summary: This module analyzes image headers and returns image size. License: MIT URL: https://github.com/shibukawa/imagesize_py Source0: https://files.pythonhosted.org/packages/source/i/imagesize/imagesize-%{version}.tar.gz +Patch0001: 0001-added-support-for-webp-files.patch +Patch0002: 0002-fixed-support-for-VP8X.patch +Patch0003: 0003-Update-imagesize.py.patch BuildArch: noarch BuildRequires: python3-setuptools BuildRequires: python3-devel python3-pytest @@ -20,7 +23,7 @@ Summary: This module analyzes image headers and returns image size. This module analyzes JPEG/JPEG 2000/PNG/GIF/TIFF image headers and returns image size. %prep -%autosetup -n imagesize-%{version} +%autosetup -n imagesize-%{version} -p1 rm -rf imagesize.egg-info %build %py3_build @@ -34,6 +37,15 @@ py.test-3 --ignore=./test/test_get_filelike.py %{python3_sitelib}/* %changelog +* Thu Dec 28 2023 zhangliangpengkun - 1.3.0-6 +- Update imagesize.py + +* Fri Dec 22 2023 zhangliangpengkun - 1.3.0-5 +- fixed support for VP8X + +* Thu Oct 19 2023 zhangliangpengkun - 1.3.0-4 +- added support for webp files + * Tue Oct 25 2022 zhangruifang - 1.3.0-3 - Rebuild for next release