Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-imagesize for 
openSUSE:Factory checked in at 2022-01-11 21:17:17
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-imagesize (Old)
 and      /work/SRC/openSUSE:Factory/.python-imagesize.new.1892 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-imagesize"

Tue Jan 11 21:17:17 2022 rev:8 rq:945445 version:1.3.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-imagesize/python-imagesize.changes        
2020-03-08 22:21:54.391994870 +0100
+++ 
/work/SRC/openSUSE:Factory/.python-imagesize.new.1892/python-imagesize.changes  
    2022-01-11 21:20:38.077016433 +0100
@@ -1,0 +2,10 @@
+Mon Nov 29 11:12:37 UTC 2021 - Dirk M??ller <[email protected]>
+
+- update to 1.3.0:
+  * Python 3.9 compat
+  * Fix exception on corrupt JPEG files
+  * Fix error on long float numbers
+  * improving netpbm error messages
+  * remove dependency on nose
+
+-------------------------------------------------------------------

Old:
----
  imagesize-1.2.0.tar.gz

New:
----
  imagesize-1.3.0.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-imagesize.spec ++++++
--- /var/tmp/diff_new_pack.2nKBRv/_old  2022-01-11 21:20:38.517016743 +0100
+++ /var/tmp/diff_new_pack.2nKBRv/_new  2022-01-11 21:20:38.525016749 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package python-imagesize
 #
-# Copyright (c) 2020 SUSE LLC
+# Copyright (c) 2022 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -18,7 +18,7 @@
 
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 Name:           python-imagesize
-Version:        1.2.0
+Version:        1.3.0
 Release:        0
 Summary:        Getting image size from PNG/JPEG/JPEG2000/GIF files
 License:        MIT
@@ -54,6 +54,7 @@
 %python_install
 
 %check
+rm -v test/test_get_filelike.py
 %pytest
 
 %files %{python_files}

++++++ imagesize-1.2.0.tar.gz -> imagesize-1.3.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/imagesize-1.2.0/PKG-INFO new/imagesize-1.3.0/PKG-INFO
--- old/imagesize-1.2.0/PKG-INFO        2019-12-26 17:13:14.000000000 +0100
+++ new/imagesize-1.3.0/PKG-INFO        2021-11-09 17:05:46.005883700 +0100
@@ -1,23 +1,11 @@
-Metadata-Version: 1.2
+Metadata-Version: 2.1
 Name: imagesize
-Version: 1.2.0
+Version: 1.3.0
 Summary: Getting image size from png/jpeg/jpeg2000/gif file
 Home-page: https://github.com/shibukawa/imagesize_py
 Author: Yoshiki Shibukawa
 Author-email: [email protected]
 License: MIT
-Description: 
-        It parses image files' header and return image size.
-        
-        * PNG
-        * JPEG
-        * JPEG2000
-        * GIF
-        * TIFF (experimental)
-        * SVG
-        
-        This is a pure Python library.
-        
 Platform: UNKNOWN
 Classifier: Development Status :: 5 - Production/Stable
 Classifier: Intended Audience :: Developers
@@ -33,7 +21,24 @@
 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 :: Implementation :: CPython
 Classifier: Programming Language :: Python :: Implementation :: PyPy
 Classifier: Topic :: Multimedia :: Graphics
 Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*
+License-File: LICENSE.rst
+
+
+It parses image files' header and return image size.
+
+* PNG
+* JPEG
+* JPEG2000
+* GIF
+* TIFF
+* SVG
+* Netpbm
+
+This is a pure Python library.
+
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/imagesize-1.2.0/README.rst 
new/imagesize-1.3.0/README.rst
--- old/imagesize-1.2.0/README.rst      2019-12-26 17:09:43.000000000 +0100
+++ new/imagesize-1.3.0/README.rst      2021-11-09 16:28:59.000000000 +0100
@@ -4,7 +4,7 @@
 .. 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 image headers and returns 
image size.
+This module analyzes JPEG/JPEG 2000/PNG/GIF/TIFF/SVG/Netpbm image headers and 
returns image size or DIP.
 
 .. code:: python
 
@@ -13,7 +13,10 @@
    width, height = imagesize.get("test.png")
    print(width, height)
 
-This module is a pure Python module.
+   width, height = imagesize.getDPI("test.png")
+   print(width, height)
+
+This module is a pure Python module. You can use file like object like file or 
something like ``io.BytesIO``.
 
 API
 -----
@@ -21,12 +24,10 @@
 * ``imagesize.get(filepath)``
 
   Returns image size (width, height).
-  ``get_from_bytes(bytes)`` is for bytes.
 
 * ``imagesize.getDPI(filepath)``
 
-  Returns DPI value.
-  ``getDPI_from_bytes(bytes)`` is for bytes.
+  Returns image DPI (width, height).
 
 Benchmark
 ------------
@@ -45,15 +46,6 @@
 
 I tested on MacBookPro (2014/Core i7) with 125kB PNG files.
 
-Restriction
----------------
-
-* TIFF
-
-  It can returns only first picture's size because of restriction of API 
design.
-
-  It supports only small TIFF file. BigTIFF support is not implemented.
-
 Development
 ---------------
 
@@ -92,3 +84,9 @@
 * Jack Cherng (https://github.com/jfcherng)
 * Tyler A. Young (https://github.com/s3cur3)
 * Mark Browning (https://github.com/mabrowning)
+* ossdev07 (https://github.com/ossdev07)
+* Nicholas-Schaub (https://github.com/Nicholas-Schaub)
+* Nuffknacker (https://github.com/Nuffknacker) 
+* Hannes R??mer (https://github.com/hroemer)
+* mikey (https://github.com/ffreemt)
+* Marco (https://github.com/marcoffee)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/imagesize-1.2.0/imagesize.egg-info/PKG-INFO 
new/imagesize-1.3.0/imagesize.egg-info/PKG-INFO
--- old/imagesize-1.2.0/imagesize.egg-info/PKG-INFO     2019-12-26 
17:13:13.000000000 +0100
+++ new/imagesize-1.3.0/imagesize.egg-info/PKG-INFO     2021-11-09 
17:05:45.000000000 +0100
@@ -1,23 +1,11 @@
-Metadata-Version: 1.2
+Metadata-Version: 2.1
 Name: imagesize
-Version: 1.2.0
+Version: 1.3.0
 Summary: Getting image size from png/jpeg/jpeg2000/gif file
 Home-page: https://github.com/shibukawa/imagesize_py
 Author: Yoshiki Shibukawa
 Author-email: [email protected]
 License: MIT
-Description: 
-        It parses image files' header and return image size.
-        
-        * PNG
-        * JPEG
-        * JPEG2000
-        * GIF
-        * TIFF (experimental)
-        * SVG
-        
-        This is a pure Python library.
-        
 Platform: UNKNOWN
 Classifier: Development Status :: 5 - Production/Stable
 Classifier: Intended Audience :: Developers
@@ -33,7 +21,24 @@
 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 :: Implementation :: CPython
 Classifier: Programming Language :: Python :: Implementation :: PyPy
 Classifier: Topic :: Multimedia :: Graphics
 Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*
+License-File: LICENSE.rst
+
+
+It parses image files' header and return image size.
+
+* PNG
+* JPEG
+* JPEG2000
+* GIF
+* TIFF
+* SVG
+* Netpbm
+
+This is a pure Python library.
+
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/imagesize-1.2.0/imagesize.egg-info/SOURCES.txt 
new/imagesize-1.3.0/imagesize.egg-info/SOURCES.txt
--- old/imagesize-1.2.0/imagesize.egg-info/SOURCES.txt  2019-12-26 
17:13:13.000000000 +0100
+++ new/imagesize-1.3.0/imagesize.egg-info/SOURCES.txt  2021-11-09 
17:05:45.000000000 +0100
@@ -10,10 +10,18 @@
 imagesize.egg-info/top_level.txt
 test/__init__.py
 test/test_get.py
+test/test_get_filelike.py
+test/test_getdpi.py
 test/images/multipage_tiff_example.tif
+test/images/test-ascii.pbm
+test/images/test-ascii.pgm
+test/images/test-ascii.ppm
 test/images/test.gif
 test/images/test.jp2
 test/images/test.jpg
+test/images/test.pbm
+test/images/test.pgm
 test/images/test.png
+test/images/test.ppm
 test/images/test.svg
 test/images/test.tiff
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/imagesize-1.2.0/imagesize.py 
new/imagesize-1.3.0/imagesize.py
--- old/imagesize-1.2.0/imagesize.py    2019-12-26 16:53:43.000000000 +0100
+++ new/imagesize-1.3.0/imagesize.py    2021-11-09 16:08:05.000000000 +0100
@@ -1,3 +1,5 @@
+import io
+import os
 import re
 import struct
 from xml.etree import ElementTree
@@ -55,40 +57,45 @@
 
 
 def _convertToPx(value):
-    matched = re.match(r"(\d+)(?:\.\d)?([a-z]*)$", value)
+    matched = re.match(r"(\d+(?:\.\d+)?)?([a-z]*)$", value)
     if not matched:
         raise ValueError("unknown length value: %s" % value)
-    else:
-        length, unit = matched.groups()
-        if unit == "":
-            return int(length)
-        elif unit == "cm":
-            return int(length) * 96 / 2.54
-        elif unit == "mm":
-            return int(length) * 96 / 2.54 / 10
-        elif unit == "in":
-            return int(length) * 96
-        elif unit == "pc":
-            return int(length) * 96 / 6
-        elif unit == "pt":
-            return int(length) * 96 / 6
-        elif unit == "px":
-            return int(length)
-        else:
-            raise ValueError("unknown unit type: %s" % unit)
+
+    length, unit = matched.groups()
+    if unit == "":
+        return float(length)
+    elif unit == "cm":
+        return float(length) * 96 / 2.54
+    elif unit == "mm":
+        return float(length) * 96 / 2.54 / 10
+    elif unit == "in":
+        return float(length) * 96
+    elif unit == "pc":
+        return float(length) * 96 / 6
+    elif unit == "pt":
+        return float(length) * 96 / 6
+    elif unit == "px":
+        return float(length)
+
+    raise ValueError("unknown unit type: %s" % unit)
 
 
 def get(filepath):
     """
     Return (width, height) for a given img file content
     no requirements
-    :type filepath: Union[str, pathlib.Path]
+    :type filepath: Union[bytes, str, pathlib.Path]
     :rtype Tuple[int, int]
     """
     height = -1
     width = -1
 
-    with open(str(filepath), 'rb') as fhandle:
+    if isinstance(filepath, io.BytesIO):  # file-like object
+        fhandle = filepath
+    else:
+        fhandle = open(filepath, 'rb')
+
+    try:
         head = fhandle.read(24)
         size = len(head)
         # handle GIFs
@@ -127,7 +134,7 @@
                 # We are at a SOFn block
                 fhandle.seek(1, 1)  # Skip `precision' byte.
                 height, width = struct.unpack('>HH', fhandle.read(4))
-            except struct.error:
+            except (struct.error, TypeError):
                 raise ValueError("Invalid JPEG file")
         # handle JPEG2000s
         elif size >= 12 and head.startswith(b'\x00\x00\x00\x0cjP  \r\n\x87\n'):
@@ -175,15 +182,76 @@
                     break
             if width == -1 or height == -1:
                 raise ValueError("Invalid TIFF file: width and/or height IDS 
entries are missing.")
+        # handle little endian BigTiff
+        elif size >= 8 and head.startswith(b"\x49\x49\x2b\x00"):
+            bytesize_offset = struct.unpack('<L', head[4:8])[0]
+            if bytesize_offset != 8:
+                raise ValueError('Invalid BigTIFF file: Expected offset to be 
8, found {} instead.'.format(offset))
+            offset = struct.unpack('<Q', head[8:16])[0]
+            fhandle.seek(offset)
+            ifdsize = struct.unpack("<Q", fhandle.read(8))[0]
+            for i in range(ifdsize):
+                tag, datatype, count, data = struct.unpack("<HHQQ", 
fhandle.read(20))
+                if tag == 256:
+                    width = data
+                elif tag == 257:
+                    height = data
+                if width != -1 and height != -1:
+                    break
+            if width == -1 or height == -1:
+                raise ValueError("Invalid BigTIFF file: width and/or height 
IDS entries are missing.")
+
         # handle SVGs
-        elif size >= 5 and head.startswith(b'<?xml'):
+        elif size >= 5 and (head.startswith(b'<?xml') or 
head.startswith(b'<svg')):
+            fhandle.seek(0)
+            data = fhandle.read(1024)
             try:
-                fhandle.seek(0)
-                root = ElementTree.parse(fhandle).getroot()
-                width = _convertToPx(root.attrib["width"])
-                height = _convertToPx(root.attrib["height"])
+                data = data.decode('utf-8')
+                width = re.search(r'[^-]width="(.*?)"', data).group(1)
+                height = re.search(r'[^-]height="(.*?)"', data).group(1)
             except Exception:
                 raise ValueError("Invalid SVG file")
+            width = _convertToPx(width)
+            height = _convertToPx(height)
+
+        # handle Netpbm
+        elif head[:1] == b"P" and head[1:2] in b"123456":
+            fhandle.seek(2)
+            sizes = []
+
+            while True:
+                next_chr = fhandle.read(1)
+
+                if next_chr.isspace():
+                    continue
+
+                if next_chr == b"":
+                    raise ValueError("Invalid Netpbm file")
+
+                if next_chr == b"#":
+                    fhandle.readline()
+                    continue
+
+                if not next_chr.isdigit():
+                    raise ValueError("Invalid character found on Netpbm file")
+
+                size = next_chr
+                next_chr = fhandle.read(1)
+
+                while next_chr.isdigit():
+                    size += next_chr
+                    next_chr = fhandle.read(1)
+
+                sizes.append(int(size))
+
+                if len(sizes) == 2:
+                    break
+
+                fhandle.seek(-1, os.SEEK_CUR)
+            width, height = sizes
+
+    finally:
+        fhandle.close()
 
     return width, height
 
@@ -192,12 +260,16 @@
     """
     Return (x DPI, y DPI) for a given img file content
     no requirements
-    :type filepath: Union[str, pathlib.Path]
+    :type filepath: Union[bytes, str, pathlib.Path]
     :rtype Tuple[int, int]
     """
     xDPI = -1
     yDPI = -1
-    with open(str(filepath), 'rb') as fhandle:
+
+    if not isinstance(filepath, bytes):
+        filepath = str(filepath)
+
+    with open(filepath, 'rb') as fhandle:
         head = fhandle.read(24)
         size = len(head)
         # handle GIFs
@@ -266,36 +338,27 @@
             foundResBox = False
             try:
                 while headerSize > 0:
-                    print("headerSize", headerSize)
                     boxHeader = fhandle.read(8)
                     boxType = boxHeader[4:]
-                    print(boxType)
-                    if boxType == 'res ':  # find resolution super box
+                    if boxType == b'res ':  # find resolution super box
                         foundResBox = True
                         headerSize -= 8
-                        print("found res super box")
                         break
-                    print("@1", boxHeader)
                     boxSize, = struct.unpack('>L', boxHeader[:4])
-                    print("boxSize", boxSize)
                     fhandle.seek(boxSize - 8, 1)
                     headerSize -= boxSize
                 if foundResBox:
                     while headerSize > 0:
                         boxHeader = fhandle.read(8)
                         boxType = boxHeader[4:]
-                        print(boxType)
-                        if boxType == 'resd':  # Display resolution box
-                            print("@2")
+                        if boxType == b'resd':  # Display resolution box
                             yDensity, xDensity, yUnit, xUnit = 
struct.unpack(">HHBB", fhandle.read(10))
                             xDPI = _convertToDPI(xDensity, xUnit)
                             yDPI = _convertToDPI(yDensity, yUnit)
                             break
                         boxSize, = struct.unpack('>L', boxHeader[:4])
-                        print("boxSize", boxSize)
                         fhandle.seek(boxSize - 8, 1)
                         headerSize -= boxSize
             except struct.error as e:
-                print(e)
                 raise ValueError("Invalid JPEG2000 file")
     return xDPI, yDPI
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/imagesize-1.2.0/setup.cfg 
new/imagesize-1.3.0/setup.cfg
--- old/imagesize-1.2.0/setup.cfg       2019-12-26 17:13:14.000000000 +0100
+++ new/imagesize-1.3.0/setup.cfg       2021-11-09 17:05:46.006087500 +0100
@@ -1,9 +1,6 @@
 [bdist_wheel]
 universal = 1
 
-[metadata]
-license_file = LICENSE.rst
-
 [egg_info]
 tag_build = 
 tag_date = 0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/imagesize-1.2.0/setup.py new/imagesize-1.3.0/setup.py
--- old/imagesize-1.2.0/setup.py        2019-12-26 17:10:15.000000000 +0100
+++ new/imagesize-1.3.0/setup.py        2021-11-09 16:29:46.000000000 +0100
@@ -3,7 +3,7 @@
 from setuptools import setup
 
 setup(name='imagesize',
-      version='1.2.0',
+      version='1.3.0',
       description='Getting image size from png/jpeg/jpeg2000/gif file',
       long_description='''
 It parses image files' header and return image size.
@@ -12,8 +12,9 @@
 * JPEG
 * JPEG2000
 * GIF
-* TIFF (experimental)
+* TIFF
 * SVG
+* Netpbm
 
 This is a pure Python library.
 ''',
@@ -22,8 +23,8 @@
       url='https://github.com/shibukawa/imagesize_py',
       license="MIT",
       py_modules=['imagesize'],
-      test_suite='test',
       python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*",
+
       classifiers=[
           'Development Status :: 5 - Production/Stable',
           'Intended Audience :: Developers',
@@ -39,6 +40,7 @@
           'Programming Language :: Python :: 3.6',
           'Programming Language :: Python :: 3.7',
           'Programming Language :: Python :: 3.8',
+          'Programming Language :: Python :: 3.9',
           'Programming Language :: Python :: Implementation :: CPython',
           'Programming Language :: Python :: Implementation :: PyPy',
           'Topic :: Multimedia :: Graphics'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/imagesize-1.2.0/test/images/test-ascii.pbm 
new/imagesize-1.3.0/test/images/test-ascii.pbm
--- old/imagesize-1.2.0/test/images/test-ascii.pbm      1970-01-01 
01:00:00.000000000 +0100
+++ new/imagesize-1.3.0/test/images/test-ascii.pbm      2021-11-09 
16:07:47.000000000 +0100
@@ -0,0 +1,23 @@
+P1
+#Created with GIMP
+65 20
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
+0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 
1 1 1 1 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 
+0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 1 1 1 
1 1 1 1 1 1 1 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 
+0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 
0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 
+0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 
+0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 
+0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 
+0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 
+0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 1 1 1 
1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 
+0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 1 
1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 
+0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
0 1 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 
+0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 
+0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 
+0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 
+0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 
+0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 
+0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 
0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 
+0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 1 1 1 1 
1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 
+0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 1 1 
0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/imagesize-1.2.0/test/images/test-ascii.pgm 
new/imagesize-1.3.0/test/images/test-ascii.pgm
--- old/imagesize-1.2.0/test/images/test-ascii.pgm      1970-01-01 
01:00:00.000000000 +0100
+++ new/imagesize-1.3.0/test/images/test-ascii.pgm      2021-11-09 
16:07:47.000000000 +0100
@@ -0,0 +1,24 @@
+P2
+#Created with GIMP
+65 20
+255
+255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 
+255 246 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 212 255 179 0 0 0 0 0 0 0 0 0 0 28 255 
255 255 255 255 254 211 150 95 50 59 105 136 185 226 253 255 246 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 0 212 
+255 246 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 212 255 179 0 0 0 0 0 0 0 0 0 0 28 255 
255 255 255 246 128 0 0 0 0 0 0 0 0 0 207 255 246 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
212 
+255 255 255 255 255 255 255 255 167 0 98 255 255 255 255 255 255 255 255 179 0 
77 255 255 255 255 255 255 255 255 255 255 255 255 255 139 0 22 169 228 246 252 
241 227 192 135 210 255 255 255 255 255 255 255 255 167 0 98 255 255 255 255 
255 255 255 
+255 255 255 255 255 255 255 255 167 0 98 255 255 255 255 255 255 255 255 179 0 
77 255 255 255 255 255 255 255 255 255 255 255 255 235 0 0 193 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 167 0 98 255 255 255 255 
255 255 255 
+255 255 255 255 255 255 255 255 167 0 98 255 255 255 255 255 255 255 255 179 0 
77 255 255 255 255 255 255 255 255 255 255 255 255 214 0 0 236 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 167 0 98 255 255 255 255 
255 255 255 
+255 255 255 255 255 255 255 255 167 0 98 255 255 255 255 255 255 255 255 179 0 
77 255 255 255 255 255 255 255 255 255 255 255 255 219 0 0 214 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 167 0 98 255 255 255 255 
255 255 255 
+255 255 255 255 255 255 255 255 167 0 98 255 255 255 255 255 255 255 255 179 0 
77 255 255 255 255 255 255 255 255 255 255 255 255 248 61 0 81 205 246 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 167 0 98 255 255 255 255 
255 255 255 
+255 255 255 255 255 255 255 255 167 0 98 255 255 255 255 255 255 255 255 179 0 
0 0 0 0 0 0 0 0 0 170 255 255 255 255 209 28 0 0 13 102 155 194 231 255 255 255 
255 255 255 255 255 255 255 255 167 0 98 255 255 255 255 255 255 255 
+255 255 255 255 255 255 255 255 167 0 98 255 255 255 255 255 255 255 255 179 0 
0 0 0 0 0 0 0 0 0 170 255 255 255 255 255 231 152 42 0 0 0 0 0 115 222 255 255 
255 255 255 255 255 255 255 167 0 98 255 255 255 255 255 255 255 
+255 255 255 255 255 255 255 255 167 0 98 255 255 255 255 255 255 255 255 179 0 
77 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 250 223 194 
160 88 0 0 22 208 255 255 255 255 255 255 255 255 167 0 98 255 255 255 255 255 
255 255 
+255 255 255 255 255 255 255 255 167 0 98 255 255 255 255 255 255 255 255 179 0 
77 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 254 210 61 0 64 247 255 255 255 255 255 255 255 167 0 98 255 255 255 255 
255 255 255 
+255 255 255 255 255 255 255 255 167 0 98 255 255 255 255 255 255 255 255 179 0 
77 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 199 0 0 212 255 255 255 255 255 255 255 167 0 98 255 255 255 255 
255 255 255 
+255 255 255 255 255 255 255 255 167 0 98 255 255 255 255 255 255 255 255 179 0 
77 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 237 0 0 194 255 255 255 255 255 255 255 167 0 98 255 255 255 255 
255 255 255 
+255 255 255 255 255 255 255 255 167 0 98 255 255 255 255 255 255 255 255 179 0 
77 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 233 0 0 202 255 255 255 255 255 255 255 167 0 98 255 255 255 255 
255 255 255 
+255 255 255 255 255 255 255 255 167 0 98 255 255 255 255 255 255 255 255 179 0 
77 255 255 255 255 255 255 255 255 255 255 255 255 224 181 249 255 255 255 255 
255 255 255 165 0 0 232 255 255 255 255 255 255 255 167 0 98 255 255 255 255 
255 255 255 
+255 255 255 255 255 255 255 255 167 0 98 255 255 255 255 255 255 255 255 179 0 
77 255 255 255 255 255 255 255 255 255 255 255 255 220 0 66 174 221 245 252 242 
220 142 0 0 140 255 255 255 255 255 255 255 255 167 0 98 255 255 255 255 255 
255 255 
+255 255 255 255 255 255 255 255 167 0 98 255 255 255 255 255 255 255 255 179 0 
0 0 0 0 0 0 0 0 0 0 231 255 255 220 0 0 0 0 0 0 0 0 0 0 132 246 255 255 255 255 
255 255 255 255 167 0 98 255 255 255 255 255 255 255 
+255 255 255 255 255 255 255 255 167 0 98 255 255 255 255 255 255 255 255 179 0 
0 0 0 0 0 0 0 0 0 0 231 255 255 254 232 196 151 117 83 34 61 108 159 216 255 
255 255 255 255 255 255 255 255 255 167 0 98 255 255 255 255 255 255 255 
+255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/imagesize-1.2.0/test/images/test-ascii.ppm 
new/imagesize-1.3.0/test/images/test-ascii.ppm
--- old/imagesize-1.2.0/test/images/test-ascii.ppm      1970-01-01 
01:00:00.000000000 +0100
+++ new/imagesize-1.3.0/test/images/test-ascii.ppm      2021-11-09 
16:07:47.000000000 +0100
@@ -0,0 +1,24 @@
+P3
+#Created with GIMP
+65 20
+255
+255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
+255 255 255 246 246 246 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 212 212 212 255 255 255 179 179 179 0 0 0 0 
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 28 28 28 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 254 254 254 211 211 211 150 150 150 
95 95 95 50 50 50 59 59 59 105 105 105 136 136 136 185 185 185 226 226 226 253 
253 253 255 255 255 246 246 246 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 212 212 212 
+255 255 255 246 246 246 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 212 212 212 255 255 255 179 179 179 0 0 0 0 
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 28 28 28 255 255 255 255 
255 255 255 255 255 255 255 255 246 246 246 128 128 128 0 0 0 0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 207 207 207 255 255 255 246 246 246 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 212 
212 212 
+255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 167 167 167 0 0 0 98 98 98 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 179 179 179 0 0 
0 77 77 77 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 139 139 139 0 0 0 22 22 22 169 169 169 228 228 228 246 246 246 252 252 
252 241 241 241 227 227 227 192 192 192 135 135 135 210 210 210 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
167 167 167 0 0 0 98 98 98 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 
+255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 167 167 167 0 0 0 98 98 98 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 179 179 179 0 0 
0 77 77 77 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 235 
235 235 0 0 0 0 0 0 193 193 193 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 167 
167 167 0 0 0 98 98 98 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 
+255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 167 167 167 0 0 0 98 98 98 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 179 179 179 0 0 
0 77 77 77 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 214 
214 214 0 0 0 0 0 0 236 236 236 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 167 
167 167 0 0 0 98 98 98 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 
+255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 167 167 167 0 0 0 98 98 98 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 179 179 179 0 0 
0 77 77 77 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 219 
219 219 0 0 0 0 0 0 214 214 214 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 167 
167 167 0 0 0 98 98 98 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 
+255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 167 167 167 0 0 0 98 98 98 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 179 179 179 0 0 
0 77 77 77 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 248 
248 248 61 61 61 0 0 0 81 81 81 205 205 205 246 246 246 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 167 
167 167 0 0 0 98 98 98 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 
+255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 167 167 167 0 0 0 98 98 98 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 179 179 179 0 0 
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 170 170 170 255 255 255 
255 255 255 255 255 255 255 255 255 209 209 209 28 28 28 0 0 0 0 0 0 13 13 13 
102 102 102 155 155 155 194 194 194 231 231 231 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 167 167 167 0 0 0 98 98 98 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 
+255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 167 167 167 0 0 0 98 98 98 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 179 179 179 0 0 
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 170 170 170 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 231 231 231 152 152 152 42 42 
42 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 115 115 115 222 222 222 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 167 167 167 0 0 0 98 98 98 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 
+255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 167 167 167 0 0 0 98 98 98 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 179 179 179 0 0 
0 77 77 77 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 250 250 250 223 223 223 194 194 194 
160 160 160 88 88 88 0 0 0 0 0 0 22 22 22 208 208 208 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 167 167 
167 0 0 0 98 98 98 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 
+255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 167 167 167 0 0 0 98 98 98 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 179 179 179 0 0 
0 77 77 77 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 254 254 254 210 210 210 61 61 61 0 0 0 64 64 64 247 247 247 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 167 
167 167 0 0 0 98 98 98 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 
+255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 167 167 167 0 0 0 98 98 98 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 179 179 179 0 0 
0 77 77 77 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 199 199 199 0 0 0 0 0 0 212 212 212 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 167 
167 167 0 0 0 98 98 98 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 
+255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 167 167 167 0 0 0 98 98 98 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 179 179 179 0 0 
0 77 77 77 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 237 237 237 0 0 0 0 0 0 194 194 194 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 167 
167 167 0 0 0 98 98 98 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 
+255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 167 167 167 0 0 0 98 98 98 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 179 179 179 0 0 
0 77 77 77 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 233 233 233 0 0 0 0 0 0 202 202 202 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 167 
167 167 0 0 0 98 98 98 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 
+255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 167 167 167 0 0 0 98 98 98 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 179 179 179 0 0 
0 77 77 77 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 224 
224 224 181 181 181 249 249 249 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 165 165 165 0 0 0 0 0 0 232 232 232 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 167 
167 167 0 0 0 98 98 98 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 
+255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 167 167 167 0 0 0 98 98 98 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 179 179 179 0 0 
0 77 77 77 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 220 
220 220 0 0 0 66 66 66 174 174 174 221 221 221 245 245 245 252 252 252 242 242 
242 220 220 220 142 142 142 0 0 0 0 0 0 140 140 140 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 167 167 167 
0 0 0 98 98 98 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 
+255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 167 167 167 0 0 0 98 98 98 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 179 179 179 0 0 
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 231 231 231 255 
255 255 255 255 255 220 220 220 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 132 132 132 246 246 246 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 167 167 167 0 0 0 98 98 98 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 
+255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 167 167 167 0 0 0 98 98 98 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 179 179 179 0 0 
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 231 231 231 255 
255 255 255 255 255 254 254 254 232 232 232 196 196 196 151 151 151 117 117 117 
83 83 83 34 34 34 61 61 61 108 108 108 159 159 159 216 216 216 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 167 167 167 0 0 0 98 98 98 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 
+255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 
Binary files old/imagesize-1.2.0/test/images/test.pbm and 
new/imagesize-1.3.0/test/images/test.pbm differ
Binary files old/imagesize-1.2.0/test/images/test.pgm and 
new/imagesize-1.3.0/test/images/test.pgm differ
Binary files old/imagesize-1.2.0/test/images/test.ppm and 
new/imagesize-1.3.0/test/images/test.ppm differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/imagesize-1.2.0/test/test_get.py 
new/imagesize-1.3.0/test/test_get.py
--- old/imagesize-1.2.0/test/test_get.py        2019-12-26 16:53:43.000000000 
+0100
+++ new/imagesize-1.3.0/test/test_get.py        2021-11-09 16:07:47.000000000 
+0100
@@ -1,10 +1,15 @@
 import unittest
 import os
-import sys
-sys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))
 import imagesize
 
+try:
+    from pathlib import Path
+except ImportError:
+    # Python 2
+    Path = None
+
 imagedir = os.path.join(os.path.dirname(__file__), "images")
+imagedir_bytes = imagedir.encode("utf-8")
 
 
 class GetTest(unittest.TestCase):
@@ -42,3 +47,101 @@
         width, height = imagesize.get(os.path.join(imagedir, 
"multipage_tiff_example.tif"))
         self.assertEqual(width, 800)
         self.assertEqual(height, 600)
+
+    def test_load_png_filelike(self):
+        """ test_load_png_filelike
+        """
+        from io import BytesIO
+
+        _ = os.path.join(imagedir, "test.png")
+        with open(_, "rb") as fhandle:
+            filelike = BytesIO(fhandle.read())
+
+        width, height = imagesize.get(filelike)
+        self.assertEqual(width, 802)
+        self.assertEqual(height, 670)
+
+    def test_netpbm(self):
+        for test_type in ["test", "test-ascii"]:
+            for test_ext in ["pbm", "pgm", "ppm"]:
+                test_file = os.path.join(imagedir, "{}.{}".format(test_type, 
test_ext))
+                width, height = imagesize.get(test_file)
+                self.assertEqual(width, 65)
+                self.assertEqual(height, 20)
+
+    def test_load_png_bytes(self):
+        width, height = imagesize.get(os.path.join(imagedir_bytes, 
b"test.png"))
+        self.assertEqual(width, 802)
+        self.assertEqual(height, 670)
+
+    def test_load_jpeg_bytes(self):
+        width, height = imagesize.get(os.path.join(imagedir_bytes, 
b"test.jpg"))
+        self.assertEqual(width, 802)
+        self.assertEqual(height, 670)
+
+    def test_load_jpeg2000_bytes(self):
+        width, height = imagesize.get(os.path.join(imagedir_bytes, 
b"test.jp2"))
+        self.assertEqual(width, 802)
+        self.assertEqual(height, 670)
+
+    def test_load_gif_bytes(self):
+        width, height = imagesize.get(os.path.join(imagedir_bytes, 
b"test.gif"))
+        self.assertEqual(width, 802)
+        self.assertEqual(height, 670)
+
+    def test_bigendian_tiff_bytes(self):
+        width, height = imagesize.get(os.path.join(imagedir_bytes, 
b"test.tiff"))
+        self.assertEqual(width, 802)
+        self.assertEqual(height, 670)
+
+    def test_load_svg_bytes(self):
+        width, height = imagesize.get(os.path.join(imagedir_bytes, 
b"test.svg"))
+        self.assertEqual(width, 90)
+        self.assertEqual(height, 60)
+
+    def test_littleendian_tiff_bytes(self):
+        width, height = imagesize.get(os.path.join(imagedir_bytes, 
b"multipage_tiff_example.tif"))
+        self.assertEqual(width, 800)
+        self.assertEqual(height, 600)
+
+    @unittest.skipIf(Path is None, "requires pathlib support")
+    def test_load_png_path(self):
+        width, height = imagesize.get(Path(imagedir, "test.png"))
+        self.assertEqual(width, 802)
+        self.assertEqual(height, 670)
+
+    @unittest.skipIf(Path is None, "requires pathlib support")
+    def test_load_jpeg_path(self):
+        width, height = imagesize.get(Path(imagedir, "test.jpg"))
+        self.assertEqual(width, 802)
+        self.assertEqual(height, 670)
+
+    @unittest.skipIf(Path is None, "requires pathlib support")
+    def test_load_jpeg2000_path(self):
+        width, height = imagesize.get(Path(imagedir, "test.jp2"))
+        self.assertEqual(width, 802)
+        self.assertEqual(height, 670)
+
+    @unittest.skipIf(Path is None, "requires pathlib support")
+    def test_load_gif_path(self):
+        width, height = imagesize.get(Path(imagedir, "test.gif"))
+        self.assertEqual(width, 802)
+        self.assertEqual(height, 670)
+
+    @unittest.skipIf(Path is None, "requires pathlib support")
+    def test_bigendian_tiff_path(self):
+        width, height = imagesize.get(Path(imagedir, "test.tiff"))
+        self.assertEqual(width, 802)
+        self.assertEqual(height, 670)
+
+    @unittest.skipIf(Path is None, "requires pathlib support")
+    def test_load_svg_path(self):
+        width, height = imagesize.get(Path(imagedir, "test.svg"))
+        self.assertEqual(width, 90)
+        self.assertEqual(height, 60)
+
+    @unittest.skipIf(Path is None, "requires pathlib support")
+    def test_littleendian_tiff_path(self):
+        width, height = imagesize.get(Path(imagedir, 
"multipage_tiff_example.tif"))
+        self.assertEqual(width, 800)
+        self.assertEqual(height, 600)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/imagesize-1.2.0/test/test_get_filelike.py 
new/imagesize-1.3.0/test/test_get_filelike.py
--- old/imagesize-1.2.0/test/test_get_filelike.py       1970-01-01 
01:00:00.000000000 +0100
+++ new/imagesize-1.3.0/test/test_get_filelike.py       2021-11-09 
16:07:47.000000000 +0100
@@ -0,0 +1,35 @@
+"""
+test imagesize.get for filelike object io.BytesIO(raw bytes)
+
+to test:
+pytest -k test_get_filelike
+"""
+
+import os
+import sys
+
+from io import BytesIO
+try:
+    # For Python 3.0 and later
+    from urllib.request import urlopen
+except ImportError:
+    # Fall back to Python 2's urllib2
+    from urllib2 import urlopen
+
+sys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))
+import imagesize
+
+
+def test_get_filelike():
+    """ test_get_filelike. """
+
+    url = 
'https://www.tsln.com/wp-content/uploads/2018/10/bears-tsln-101318-3-1240x826.jpg'
+    try:
+        response = urlopen(url)
+        raw = response.read()
+    except Exception as exc:
+        raise SystemExit(exc)
+
+    file_like = BytesIO(raw)
+
+    assert imagesize.get(file_like) == (1240, 826)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/imagesize-1.2.0/test/test_getdpi.py 
new/imagesize-1.3.0/test/test_getdpi.py
--- old/imagesize-1.2.0/test/test_getdpi.py     1970-01-01 01:00:00.000000000 
+0100
+++ new/imagesize-1.3.0/test/test_getdpi.py     2021-11-09 16:07:47.000000000 
+0100
@@ -0,0 +1,127 @@
+import unittest
+import os
+import imagesize
+
+try:
+    from pathlib import Path
+except ImportError:
+    # Python 2
+    Path = None
+
+
+imagedir = os.path.join(os.path.dirname(__file__), "images")
+imagedir_bytes = imagedir.encode("utf-8")
+
+
+class GetDPITest(unittest.TestCase):
+    def test_png(self):
+        xdpi, ydpi = imagesize.getDPI(os.path.join(imagedir, "test.png"))
+        self.assertEqual(xdpi, 72)
+        self.assertEqual(ydpi, 72)
+
+    def test_jpeg(self):
+        xdpi, ydpi = imagesize.getDPI(os.path.join(imagedir, "test.jpg"))
+        self.assertEqual(xdpi, 72)
+        self.assertEqual(ydpi, 72)
+
+    def test_jpeg2000(self):
+        xdpi, ydpi = imagesize.getDPI(os.path.join(imagedir, "test.jp2"))
+        self.assertEqual(xdpi, -1)
+        self.assertEqual(ydpi, -1)
+
+    def test_gif(self):
+        xdpi, ydpi = imagesize.getDPI(os.path.join(imagedir, "test.gif"))
+        self.assertEqual(xdpi, -1)
+        self.assertEqual(ydpi, -1)
+
+    def test_bigendian_tiff(self):
+        xdpi, ydpi = imagesize.getDPI(os.path.join(imagedir, "test.tiff"))
+        self.assertEqual(xdpi, -1)
+        self.assertEqual(ydpi, -1)
+
+    def test_svg(self):
+        xdpi, ydpi = imagesize.getDPI(os.path.join(imagedir, "test.svg"))
+        self.assertEqual(xdpi, -1)
+        self.assertEqual(ydpi, -1)
+
+    def test_littleendian_tiff(self):
+        xdpi, ydpi = imagesize.getDPI(os.path.join(imagedir, 
"multipage_tiff_example.tif"))
+        self.assertEqual(xdpi, -1)
+        self.assertEqual(ydpi, -1)
+
+    def test_png_bytes(self):
+        xdpi, ydpi = imagesize.getDPI(os.path.join(imagedir_bytes, 
b"test.png"))
+        self.assertEqual(xdpi, 72)
+        self.assertEqual(ydpi, 72)
+
+    def test_jpeg_bytes(self):
+        xdpi, ydpi = imagesize.getDPI(os.path.join(imagedir_bytes, 
b"test.jpg"))
+        self.assertEqual(xdpi, 72)
+        self.assertEqual(ydpi, 72)
+
+    def test_jpeg2000_bytes(self):
+        xdpi, ydpi = imagesize.getDPI(os.path.join(imagedir_bytes, 
b"test.jp2"))
+        self.assertEqual(xdpi, -1)
+        self.assertEqual(ydpi, -1)
+
+    def test_gif_bytes(self):
+        xdpi, ydpi = imagesize.getDPI(os.path.join(imagedir_bytes, 
b"test.gif"))
+        self.assertEqual(xdpi, -1)
+        self.assertEqual(ydpi, -1)
+
+    def test_bigendian_tiff_bytes(self):
+        xdpi, ydpi = imagesize.getDPI(os.path.join(imagedir_bytes, 
b"test.tiff"))
+        self.assertEqual(xdpi, -1)
+        self.assertEqual(ydpi, -1)
+
+    def test_svg_bytes(self):
+        xdpi, ydpi = imagesize.getDPI(os.path.join(imagedir_bytes, 
b"test.svg"))
+        self.assertEqual(xdpi, -1)
+        self.assertEqual(ydpi, -1)
+
+    def test_littleendian_tiff_bytes(self):
+        xdpi, ydpi = imagesize.getDPI(os.path.join(imagedir_bytes, 
b"multipage_tiff_example.tif"))
+        self.assertEqual(xdpi, -1)
+        self.assertEqual(ydpi, -1)
+
+    @unittest.skipIf(Path is None, "requires pathlib support")
+    def test_png_path(self):
+        xdpi, ydpi = imagesize.getDPI(Path(imagedir, "test.png"))
+        self.assertEqual(xdpi, 72)
+        self.assertEqual(ydpi, 72)
+
+    @unittest.skipIf(Path is None, "requires pathlib support")
+    def test_jpeg_path(self):
+        xdpi, ydpi = imagesize.getDPI(Path(imagedir, "test.jpg"))
+        self.assertEqual(xdpi, 72)
+        self.assertEqual(ydpi, 72)
+
+    @unittest.skipIf(Path is None, "requires pathlib support")
+    def test_jpeg2000_path(self):
+        xdpi, ydpi = imagesize.getDPI(Path(imagedir, "test.jp2"))
+        self.assertEqual(xdpi, -1)
+        self.assertEqual(ydpi, -1)
+
+    @unittest.skipIf(Path is None, "requires pathlib support")
+    def test_gif_path(self):
+        xdpi, ydpi = imagesize.getDPI(Path(imagedir, "test.gif"))
+        self.assertEqual(xdpi, -1)
+        self.assertEqual(ydpi, -1)
+
+    @unittest.skipIf(Path is None, "requires pathlib support")
+    def test_bigendian_tiff_path(self):
+        xdpi, ydpi = imagesize.getDPI(Path(imagedir, "test.tiff"))
+        self.assertEqual(xdpi, -1)
+        self.assertEqual(ydpi, -1)
+
+    @unittest.skipIf(Path is None, "requires pathlib support")
+    def test_svg_path(self):
+        xdpi, ydpi = imagesize.getDPI(Path(imagedir, "test.svg"))
+        self.assertEqual(xdpi, -1)
+        self.assertEqual(ydpi, -1)
+
+    @unittest.skipIf(Path is None, "requires pathlib support")
+    def test_littleendian_tiff_path(self):
+        xdpi, ydpi = imagesize.getDPI(Path(imagedir, 
"multipage_tiff_example.tif"))
+        self.assertEqual(xdpi, -1)
+        self.assertEqual(ydpi, -1)

Reply via email to