Skip to content
Snippets Groups Projects
Commit ad3a299f authored by Dmitry Shachnev's avatar Dmitry Shachnev :penguin:
Browse files

New upstream version 1.4.1

parent 1c479d0f
No related branches found
No related tags found
No related merge requests found
Metadata-Version: 2.1
Name: imagesize
Version: 1.3.0
Version: 1.4.1
Summary: Getting image size from png/jpeg/jpeg2000/gif file
Home-page: https://github.com/shibukawa/imagesize_py
Author: Yoshiki Shibukawa
......@@ -22,6 +22,7 @@ Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Topic :: Multimedia :: Graphics
......@@ -38,6 +39,7 @@ It parses image files' header and return image size.
* TIFF
* SVG
* Netpbm
* WebP
This is a pure Python library.
......
......@@ -4,7 +4,7 @@ imagesize
.. image:: https://travis-ci.org/shibukawa/imagesize_py.svg?branch=master
:target: https://travis-ci.org/shibukawa/imagesize_py
This module analyzes JPEG/JPEG 2000/PNG/GIF/TIFF/SVG/Netpbm image headers and returns image size or DIP.
This module analyzes JPEG/JPEG 2000/PNG/GIF/TIFF/SVG/Netpbm/WebP image headers and returns image size or DIP.
.. code:: python
......@@ -90,3 +90,4 @@ Thank you for feedback:
* Hannes Römer (https://github.com/hroemer)
* mikey (https://github.com/ffreemt)
* Marco (https://github.com/marcoffee)
* ExtReMLapin (https://github.com/ExtReMLapin)
Metadata-Version: 2.1
Name: imagesize
Version: 1.3.0
Version: 1.4.1
Summary: Getting image size from png/jpeg/jpeg2000/gif file
Home-page: https://github.com/shibukawa/imagesize_py
Author: Yoshiki Shibukawa
......@@ -22,6 +22,7 @@ Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Topic :: Multimedia :: Graphics
......@@ -38,6 +39,7 @@ It parses image files' header and return image size.
* TIFF
* SVG
* Netpbm
* WebP
This is a pure Python library.
......
LICENSE.rst
MANIFEST.in
README.rst
imagesize.py
setup.cfg
setup.py
imagesize/__init__.py
imagesize/imagesize.py
imagesize.egg-info/PKG-INFO
imagesize.egg-info/SOURCES.txt
imagesize.egg-info/dependency_links.txt
......
__all__ = ["get", "getDPI", "__version__"]
__version__ = "1.4.1"
from .imagesize import get, getDPI
......@@ -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'):
......@@ -249,6 +249,18 @@ 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"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("Unsupported WebP file")
finally:
fhandle.close()
......
#!/usr/bin/env python
from setuptools import setup
from imagesize import __version__
setup(name='imagesize',
version='1.3.0',
version=__version__,
description='Getting image size from png/jpeg/jpeg2000/gif file',
long_description='''
It parses image files' header and return image size.
......@@ -15,6 +16,7 @@ It parses image files' header and return image size.
* TIFF
* SVG
* Netpbm
* WebP
This is a pure Python library.
''',
......@@ -22,7 +24,7 @@ This is a pure Python library.
author_email='yoshiki@shibu.jp',
url='https://github.com/shibukawa/imagesize_py',
license="MIT",
py_modules=['imagesize'],
packages=['imagesize'],
python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*",
classifiers=[
......@@ -41,6 +43,7 @@ This is a pure Python library.
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
'Topic :: Multimedia :: Graphics'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment