!30 added support for webp files

From: @wang--ge 
Reviewed-by: @caodongxia 
Signed-off-by: @caodongxia
This commit is contained in:
openeuler-ci-bot 2023-11-29 02:04:08 +00:00 committed by Gitee
commit ae055ff22b
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 34 additions and 2 deletions

View File

@ -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("<H", fhandle.read(2))[0]
+ height = struct.unpack("<H", fhandle.read(2))[0]
finally:
fhandle.close()
--
2.39.0.windows.2

View File

@ -1,10 +1,11 @@
Name: python-imagesize Name: python-imagesize
Version: 1.3.0 Version: 1.3.0
Release: 3 Release: 4
Summary: This module analyzes image headers and returns image size. Summary: This module analyzes image headers and returns image size.
License: MIT License: MIT
URL: https://github.com/shibukawa/imagesize_py URL: https://github.com/shibukawa/imagesize_py
Source0: https://files.pythonhosted.org/packages/source/i/imagesize/imagesize-%{version}.tar.gz Source0: https://files.pythonhosted.org/packages/source/i/imagesize/imagesize-%{version}.tar.gz
patch0001: 0001-added-support-for-webp-files.patch
BuildArch: noarch BuildArch: noarch
BuildRequires: python3-setuptools BuildRequires: python3-setuptools
BuildRequires: python3-devel python3-pytest BuildRequires: python3-devel python3-pytest
@ -20,7 +21,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. This module analyzes JPEG/JPEG 2000/PNG/GIF/TIFF image headers and returns image size.
%prep %prep
%autosetup -n imagesize-%{version} %autosetup -n imagesize-%{version} -p1
rm -rf imagesize.egg-info rm -rf imagesize.egg-info
%build %build
%py3_build %py3_build
@ -34,6 +35,9 @@ py.test-3 --ignore=./test/test_get_filelike.py
%{python3_sitelib}/* %{python3_sitelib}/*
%changelog %changelog
* Tue Nov 28 2023 zhangliangpengkun<zhangliangpengkun@xfusion.com> - 1.3.0-4
- added support for webp files
* Tue Oct 25 2022 zhangruifang <zhangruifang1@h-partners.com> - 1.3.0-3 * Tue Oct 25 2022 zhangruifang <zhangruifang1@h-partners.com> - 1.3.0-3
- Rebuild for next release - Rebuild for next release