Compare commits

..

10 Commits

Author SHA1 Message Date
openeuler-ci-bot
7528d17e49
!48 Sync release from 22.03-SP2
From: @wk333 
Reviewed-by: @lyn1001 
Signed-off-by: @lyn1001
2024-05-28 01:09:13 +00:00
wk333
2271aecd5c Sync release from 22.03-SP2 2024-05-27 16:48:16 +08:00
openeuler-ci-bot
92fb0f6acf
!12 【轻量级 PR】:Rebuild for next release
From: @zhangruifang2020 
Reviewed-by: @lyn1001 
Signed-off-by: @lyn1001
2022-10-31 01:17:07 +00:00
张瑞方
8dcc615973
Rebuild for next release
Signed-off-by: 张瑞方 <xdzhangruifang@163.com>
2022-10-25 07:26:02 +00:00
openeuler-ci-bot
5a177dca8a
!8 Ignore testcase test_get_filelike.py
Merge pull request !8 from renxichen/openEuler-22.03-LTS-Next
2022-01-08 03:14:02 +00:00
rwx403335
136922ee37 ignore testcase test_get_filelike.py 2022-01-07 17:42:41 +08:00
openeuler-ci-bot
ea43cdef12 !6 update to 1.3.0
Merge pull request !6 from Markeryang/openEuler-22.03-LTS-Next
2021-12-28 01:00:07 +00:00
markeryang
ed7eff524a update package to 1.3.0 2021-12-27 12:07:03 +08:00
openeuler-ci-bot
3b68edae92 !4 delete python2.
From: @weiwei_150212
Reviewed-by: @small_leek
Signed-off-by: @small_leek
2020-10-31 09:59:01 +08:00
s17723959267
89fd80b14a delete python2 2020-10-29 11:08:14 +08:00
6 changed files with 140 additions and 19 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

@ -0,0 +1,45 @@
From 013a0dd3d3be5d47befd1bddfc8f35bac77835c5 Mon Sep 17 00:00:00 2001
From: ExtReMLapin <3909752+ExtReMLapin@users.noreply.github.com>
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("<H", fhandle.read(2))[0]
- height = struct.unpack("<H", fhandle.read(2))[0]
+ if head[12:16] == b"VP8L":
+ raise ValueError("Invalid WEBP file: Not a WebP file.")
+ elif head[12:16] == b"VP8 ":
+ width, height = struct.unpack("<HH", head[26:30])
+ elif head[12:16] == b"VP8X":
+ width = struct.unpack("<I", head[24:27] + b"\0")[0]
+ height = struct.unpack("<I", head[27:30] + b"\0")[0]
+ else:
+ raise ValueError("Invalid WEBP file: Not a WebP file.")
finally:
fhandle.close()
--
2.39.0.windows.2

View File

@ -0,0 +1,38 @@
From e7c81aa290e6832754dc8eaa911d831a381135c7 Mon Sep 17 00:00:00 2001
From: ExtReMLapin <3909752+ExtReMLapin@users.noreply.github.com>
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("<HH", head[26:30])
elif head[12:16] == b"VP8X":
width = struct.unpack("<I", head[24:27] + b"\0")[0]
height = struct.unpack("<I", head[27:30] + b"\0")[0]
+ elif head[12:16] == b"VP8L":
+ b = head[21:25]
+ width = (((b[1] & 63) << 8) | b[0]) + 1
+ height = (((b[3] & 15) << 10) | (b[2] << 2) | ((b[1] & 192) >> 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

Binary file not shown.

BIN
imagesize-1.3.0.tar.gz Normal file

Binary file not shown.

View File

@ -1,24 +1,20 @@
Name: python-imagesize
Version: 1.2.0
Release: 1
Version: 1.3.0
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: python2-setuptools python2-devel python2-pytest python3-setuptools
BuildRequires: python3-setuptools
BuildRequires: python3-devel python3-pytest
%description
This module analyzes JPEG/JPEG 2000/PNG/GIF/TIFF image headers and returns image size.
%package -n python2-imagesize
Summary: This module analyzes image headers and returns image size.
%{?python_provide:%python_provide python2-imagesize}
%description -n python2-imagesize
This module analyzes JPEG/JPEG 2000/PNG/GIF/TIFF image headers and returns image size.
%package -n python3-imagesize
Summary: This module analyzes image headers and returns image size.
%{?python_provide:%python_provide python3-imagesize}
@ -27,27 +23,41 @@ 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
%py2_build
%py3_build
%install
%py3_install
%py2_install
%check
py.test-2
py.test-3
%files -n python2-imagesize
%doc README.rst LICENSE.rst
%{python2_sitelib}/*
py.test-3 --ignore=./test/test_get_filelike.py
%files -n python3-imagesize
%doc README.rst LICENSE.rst
%{python3_sitelib}/*
%changelog
* Thu Dec 28 2023 zhangliangpengkun<zhangliangpengkun@xfusion.com> - 1.3.0-6
- Update imagesize.py
* Fri Dec 22 2023 zhangliangpengkun<zhangliangpengkun@xfusion.com> - 1.3.0-5
- fixed support for VP8X
* Thu Oct 19 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
- Rebuild for next release
* Fri Jan 07 2022 renhongxun <renhongxun@huawei.com> - 1.3.0-2
- fix tests
* Mon Dec 27 2021 yanglongkang <yanglongkang@huawei.com> - 1.3.0-1
- update package to 1.3.0
* Thu Oct 29 2020 tianwei <tianwei@huawei.com> - 1.2.0-2
- delete python2 require
* Thu Jul 23 2020 dingyue <dingyue5@huawei.com> - 1.2.0-1
- Package update
* Mon Nov 25 2019 Ling Yang <lingyang2@huawei.com> - 1.0.0-4