Hello community,

here is the log from the commit of package python-imagesize for 
openSUSE:Factory checked in at 2019-05-09 14:27:30
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-imagesize (Old)
 and      /work/SRC/openSUSE:Factory/.python-imagesize.new.5148 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-imagesize"

Thu May  9 14:27:30 2019 rev:6 rq:701294 version:1.1.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-imagesize/python-imagesize.changes        
2018-12-27 00:26:37.343799005 +0100
+++ 
/work/SRC/openSUSE:Factory/.python-imagesize.new.5148/python-imagesize.changes  
    2019-05-09 14:27:31.865817017 +0200
@@ -1,0 +2,7 @@
+Tue May  7 11:30:09 UTC 2019 - [email protected]
+
+- version update to 1.1.0
+  * add TIFF support (experimental)
+- enable testsuite
+
+-------------------------------------------------------------------

Old:
----
  imagesize-1.0.0.tar.gz

New:
----
  imagesize-1.1.0.tar.gz

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

Other differences:
------------------
++++++ python-imagesize.spec ++++++
--- /var/tmp/diff_new_pack.uUs7ti/_old  2019-05-09 14:27:32.265817943 +0200
+++ /var/tmp/diff_new_pack.uUs7ti/_new  2019-05-09 14:27:32.269817952 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package python-imagesize
 #
-# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
 #
 # 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.0.0
+Version:        1.1.0
 Release:        0
 Summary:        Getting image size from PNG/JPEG/JPEG2000/GIF files
 License:        MIT
@@ -27,6 +27,9 @@
 Source:         
https://files.pythonhosted.org/packages/source/i/imagesize/imagesize-%{version}.tar.gz
 BuildRequires:  %{python_module setuptools}
 BuildRequires:  python-rpm-macros
+# SECTION test requirements
+BuildRequires:  %{python_module pytest}
+# /SECTION
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 BuildArch:      noarch
 
@@ -50,6 +53,9 @@
 %install
 %python_install
 
+%check
+%pytest
+
 %files %{python_files}
 %defattr(-,root,root,-)
 %{python_sitelib}/*

++++++ imagesize-1.0.0.tar.gz -> imagesize-1.1.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/imagesize-1.0.0/PKG-INFO new/imagesize-1.1.0/PKG-INFO
--- old/imagesize-1.0.0/PKG-INFO        2018-02-16 00:03:29.000000000 +0100
+++ new/imagesize-1.1.0/PKG-INFO        2018-09-03 04:07:59.000000000 +0200
@@ -1,6 +1,6 @@
-Metadata-Version: 1.1
+Metadata-Version: 1.2
 Name: imagesize
-Version: 1.0.0
+Version: 1.1.0
 Summary: Getting image size from png/jpeg/jpeg2000/gif file
 Home-page: https://github.com/shibukawa/imagesize_py
 Author: Yoshiki Shibukawa
@@ -13,6 +13,7 @@
         * JPEG
         * JPEG2000
         * GIF
+        * TIFF (experimental)
         
         This is a pure Python library.
         
@@ -24,13 +25,13 @@
 Classifier: Operating System :: OS Independent
 Classifier: Programming Language :: Python
 Classifier: Programming Language :: Python :: 2
-Classifier: Programming Language :: Python :: 2.6
 Classifier: Programming Language :: Python :: 2.7
 Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: 3.3
 Classifier: Programming Language :: Python :: 3.4
 Classifier: Programming Language :: Python :: 3.5
 Classifier: Programming Language :: Python :: 3.6
+Classifier: Programming Language :: Python :: 3.7
 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.*
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/imagesize-1.0.0/README.rst 
new/imagesize-1.1.0/README.rst
--- old/imagesize-1.0.0/README.rst      2018-02-15 23:57:14.000000000 +0100
+++ new/imagesize-1.1.0/README.rst      2018-08-30 17:15:06.000000000 +0200
@@ -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/jpeg2000/png/gif image header and return image size.
+This module analyzes JPEG/JPEG 2000/PNG/GIF/TIFF image headers and returns 
image size.
 
 .. code:: python
 
@@ -13,31 +13,49 @@
    width, height = imagesize.get("test.png")
    print(width, height)
 
-This module is a pure python module.
+This module is a pure Python module.
 
 API
 -----
 
 * ``imagesize.get(filepath)``
 
-  Returns image size(width, height).
+  Returns image size (width, height).
 
 Benchmark
 ------------
 
-It just parses only header, ignores pixel data. So it is much faster than 
Pillow.
+It only parses headers, and ignores pixel data. So it is much faster than 
Pillow.
 
 .. list-table::
    :header-rows: 1
 
    - * module
      * result
-   - * imagesize(pure python)
-     * 1.077 seconds per 100000 times
+   - * imagesize (pure Python)
+     * 1.077 seconds per 100 000 times
    - * Pillow
-     * 10.569 seconds per 100000 times
+     * 10.569 seconds per 100 000 times
 
-I tested on MacBookPro(2014/Core i7) with 125kB PNG files.
+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
+---------------
+
+Run test with the following command:
+
+.. code:: bash
+
+   python -m unittestt
 
 License
 -----------
@@ -47,12 +65,16 @@
 Thanks
 ----------
 
-I refers the following codes:
+I referred to the following code:
 
 * 
http://markasread.net/post/17551554979/get-image-size-info-using-pure-python-code
-* 
http://stackoverflow.com/questions/8032642/how-to-obtain-image-size-using-standard-python-class-without-using-external-lib
+* 
https://stackoverflow.com/questions/8032642/how-to-obtain-image-size-using-standard-python-class-without-using-external-lib
+
+I use sample image from here:
 
-Thank you for feedbacks:
+* 
https://www.nightprogrammer.org/development/multipage-tiff-example-download-test-image-file/
+
+Thank you for feedback:
 
 * tk0miya (https://github.com/tk0miya)
 * shimizukawa (https://github.com/shimizukawa)
@@ -60,3 +82,5 @@
 * Ivan Zakharyaschev (https://github.com/imz)
 * Jon Dufresne (https://github.com/jdufresne)
 * Geoff Lankow (https://github.com/darktrojan)
+* Hugo (https://github.com/hugovk)
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/imagesize-1.0.0/imagesize.egg-info/PKG-INFO 
new/imagesize-1.1.0/imagesize.egg-info/PKG-INFO
--- old/imagesize-1.0.0/imagesize.egg-info/PKG-INFO     2018-02-16 
00:03:29.000000000 +0100
+++ new/imagesize-1.1.0/imagesize.egg-info/PKG-INFO     2018-09-03 
04:07:59.000000000 +0200
@@ -1,6 +1,6 @@
-Metadata-Version: 1.1
+Metadata-Version: 1.2
 Name: imagesize
-Version: 1.0.0
+Version: 1.1.0
 Summary: Getting image size from png/jpeg/jpeg2000/gif file
 Home-page: https://github.com/shibukawa/imagesize_py
 Author: Yoshiki Shibukawa
@@ -13,6 +13,7 @@
         * JPEG
         * JPEG2000
         * GIF
+        * TIFF (experimental)
         
         This is a pure Python library.
         
@@ -24,13 +25,13 @@
 Classifier: Operating System :: OS Independent
 Classifier: Programming Language :: Python
 Classifier: Programming Language :: Python :: 2
-Classifier: Programming Language :: Python :: 2.6
 Classifier: Programming Language :: Python :: 2.7
 Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: 3.3
 Classifier: Programming Language :: Python :: 3.4
 Classifier: Programming Language :: Python :: 3.5
 Classifier: Programming Language :: Python :: 3.6
+Classifier: Programming Language :: Python :: 3.7
 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.*
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/imagesize-1.0.0/imagesize.egg-info/SOURCES.txt 
new/imagesize-1.1.0/imagesize.egg-info/SOURCES.txt
--- old/imagesize-1.0.0/imagesize.egg-info/SOURCES.txt  2018-02-16 
00:03:29.000000000 +0100
+++ new/imagesize-1.1.0/imagesize.egg-info/SOURCES.txt  2018-09-03 
04:07:59.000000000 +0200
@@ -8,11 +8,14 @@
 imagesize.egg-info/SOURCES.txt
 imagesize.egg-info/dependency_links.txt
 imagesize.egg-info/top_level.txt
+test/.DS_Store
 test/__init__.py
-test/__init__.pyc
 test/test_get.py
-test/test_get.pyc
+test/__pycache__/__init__.cpython-36.pyc
+test/__pycache__/test_get.cpython-36.pyc
+test/images/multipage_tiff_example.tif
 test/images/test.gif
 test/images/test.jp2
 test/images/test.jpg
-test/images/test.png
\ No newline at end of file
+test/images/test.png
+test/images/test.tiff
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/imagesize-1.0.0/imagesize.py 
new/imagesize-1.1.0/imagesize.py
--- old/imagesize-1.0.0/imagesize.py    2018-02-15 23:57:14.000000000 +0100
+++ new/imagesize-1.1.0/imagesize.py    2018-09-03 04:03:41.000000000 +0200
@@ -12,6 +12,22 @@
 _UNIT_UM = 6
 _UNIT_INCH = 6
 
+_TIFF_TYPE_SIZES = {
+  1: 1,
+  2: 1,
+  3: 2,
+  4: 4,
+  5: 8,
+  6: 1,
+  7: 1,
+  8: 2,
+  9: 4,
+  10: 8,
+  11: 4,
+  12: 8,
+}
+
+
 def _convertToDPI(density, unit):
     if unit == _UNIT_KM:
         return int(density * 0.0000254 + 0.5)
@@ -35,6 +51,7 @@
         return density * 25400
     return density
 
+
 def get(filepath):
     """
     Return (width, height) for a given img file content
@@ -69,7 +86,7 @@
         # handle JPEGs
         elif size >= 2 and head.startswith(b'\377\330'):
             try:
-                fhandle.seek(0) # Read 0xff next
+                fhandle.seek(0)  # Read 0xff next
                 size = 2
                 ftype = 0
                 while not 0xc0 <= ftype <= 0xcf or ftype in [0xc4, 0xc8, 0xcc]:
@@ -91,8 +108,49 @@
                 height, width = struct.unpack('>LL', fhandle.read(8))
             except struct.error:
                 raise ValueError("Invalid JPEG2000 file")
+        # handle big endien TIFF
+        elif size >= 8 and head.startswith(b"\x4d\x4d\x00\x2a"):
+            offset = struct.unpack('>L', head[4:8])[0]
+            fhandle.seek(offset)
+            ifdsize = struct.unpack(">H", fhandle.read(2))[0]
+            for i in range(ifdsize):
+                tag, datatype, count, data = struct.unpack(">HHLL", 
fhandle.read(12))
+                if tag == 256:
+                    if datatype == 3:
+                        width = int(data / 65536)
+                    elif datatype == 4:
+                        width = data
+                    else:
+                        raise ValueError("Invalid TIFF file: width column data 
type should be SHORT/LONG.")
+                elif tag == 257:
+                    if datatype == 3:
+                        height = int(data / 65536)
+                    elif datatype == 4:
+                        height = data
+                    else:
+                        raise ValueError("Invalid TIFF file: height column 
data type should be SHORT/LONG.")
+                if width != -1 and height != -1:
+                    break
+            if width == -1 or height == -1:
+                raise ValueError("Invalid TIFF file: width and/or height IDS 
entries are missing.")
+        elif size >= 8 and head.startswith(b"\x49\x49\x2a\x00"):
+            offset = struct.unpack('<L', head[4:8])[0]
+            fhandle.seek(offset)
+            ifdsize = struct.unpack("<H", fhandle.read(2))[0]
+            for i in range(ifdsize):
+                tag, datatype, count, data = struct.unpack("<HHLL", 
fhandle.read(12))
+                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 TIFF file: width and/or height IDS 
entries are missing.")
+
     return width, height
 
+
 def getDPI(filepath):
     """
     Return (width, height) for a given img file content
@@ -121,7 +179,7 @@
                     if unit:
                         xDPI = _convertToDPI(xDensity, _UNIT_1M)
                         yDPI = _convertToDPI(yDensity, _UNIT_1M)
-                    else: # no unit
+                    else:  # no unit
                         xDPI = xDensity
                         yDPI = yDensity
                     break
@@ -138,11 +196,11 @@
         # handle JPEGs
         elif size >= 2 and head.startswith(b'\377\330'):
             try:
-                fhandle.seek(0) # Read 0xff next
+                fhandle.seek(0)  # Read 0xff next
                 size = 2
                 ftype = 0
                 while not 0xc0 <= ftype <= 0xcf:
-                    if ftype == 0xe0: # APP0 marker
+                    if ftype == 0xe0:  # APP0 marker
                         fhandle.seek(7, 1)
                         unit, xDensity, yDensity = struct.unpack(">BHH", 
fhandle.read(5))
                         if unit == 1 or unit == 0:
@@ -173,7 +231,7 @@
                     boxHeader = fhandle.read(8)
                     boxType = boxHeader[4:]
                     print(boxType)
-                    if boxType == 'res ': # find resolution super box
+                    if boxType == 'res ':  # find resolution super box
                         foundResBox = True
                         headerSize -= 8
                         print("found res super box")
@@ -188,7 +246,7 @@
                         boxHeader = fhandle.read(8)
                         boxType = boxHeader[4:]
                         print(boxType)
-                        if boxType == 'resd': # Display resolution box
+                        if boxType == 'resd':  # Display resolution box
                             print("@2")
                             yDensity, xDensity, yUnit, xUnit = 
struct.unpack(">HHBB", fhandle.read(10))
                             xDPI = _convertToDPI(xDensity, xUnit)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/imagesize-1.0.0/setup.cfg 
new/imagesize-1.1.0/setup.cfg
--- old/imagesize-1.0.0/setup.cfg       2018-02-16 00:03:29.000000000 +0100
+++ new/imagesize-1.1.0/setup.cfg       2018-09-03 04:07:59.000000000 +0200
@@ -7,5 +7,4 @@
 [egg_info]
 tag_build = 
 tag_date = 0
-tag_svn_revision = 0
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/imagesize-1.0.0/setup.py new/imagesize-1.1.0/setup.py
--- old/imagesize-1.0.0/setup.py        2018-02-16 00:03:11.000000000 +0100
+++ new/imagesize-1.1.0/setup.py        2018-09-03 04:04:55.000000000 +0200
@@ -1,10 +1,9 @@
 #!/usr/bin/env python
 
 from setuptools import setup
-#from distutils.core import setup
 
 setup(name='imagesize',
-      version='1.0.0',
+      version='1.1.0',
       description='Getting image size from png/jpeg/jpeg2000/gif file',
       long_description='''
 It parses image files' header and return image size.
@@ -13,6 +12,7 @@
 * JPEG
 * JPEG2000
 * GIF
+* TIFF (experimental)
 
 This is a pure Python library.
 ''',
@@ -22,7 +22,8 @@
       license="MIT",
       py_modules=['imagesize'],
       test_suite='test',
-      classifiers = [
+      python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*",
+      classifiers=[
           'Development Status :: 5 - Production/Stable',
           'Intended Audience :: Developers',
           'License :: OSI Approved :: MIT License',
@@ -30,13 +31,12 @@
           'Operating System :: OS Independent',
           'Programming Language :: Python',
           'Programming Language :: Python :: 2',
-          'Programming Language :: Python :: 2.6',
           'Programming Language :: Python :: 2.7',
           'Programming Language :: Python :: 3',
-          'Programming Language :: Python :: 3.3',
           'Programming Language :: Python :: 3.4',
           'Programming Language :: Python :: 3.5',
           'Programming Language :: Python :: 3.6',
+          'Programming Language :: Python :: 3.7',
           'Programming Language :: Python :: Implementation :: CPython',
           'Programming Language :: Python :: Implementation :: PyPy',
           'Topic :: Multimedia :: Graphics'
Binary files old/imagesize-1.0.0/test/.DS_Store and 
new/imagesize-1.1.0/test/.DS_Store differ
Binary files old/imagesize-1.0.0/test/__init__.pyc and 
new/imagesize-1.1.0/test/__init__.pyc differ
Binary files old/imagesize-1.0.0/test/__pycache__/__init__.cpython-36.pyc and 
new/imagesize-1.1.0/test/__pycache__/__init__.cpython-36.pyc differ
Binary files old/imagesize-1.0.0/test/__pycache__/test_get.cpython-36.pyc and 
new/imagesize-1.1.0/test/__pycache__/test_get.cpython-36.pyc differ
Binary files old/imagesize-1.0.0/test/images/multipage_tiff_example.tif and 
new/imagesize-1.1.0/test/images/multipage_tiff_example.tif differ
Binary files old/imagesize-1.0.0/test/images/test.tiff and 
new/imagesize-1.1.0/test/images/test.tiff differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/imagesize-1.0.0/test/test_get.py 
new/imagesize-1.1.0/test/test_get.py
--- old/imagesize-1.0.0/test/test_get.py        2018-02-15 23:57:14.000000000 
+0100
+++ new/imagesize-1.1.0/test/test_get.py        2018-08-29 01:08:53.000000000 
+0200
@@ -1,10 +1,12 @@
 import unittest
-import os, sys
+import os
+import sys
 sys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))
 import imagesize
 
 imagedir = os.path.join(os.path.dirname(__file__), "images")
 
+
 class GetTest(unittest.TestCase):
     def test_load_png(self):
         width, height = imagesize.get(os.path.join(imagedir, "test.png"))
@@ -25,3 +27,13 @@
         width, height = imagesize.get(os.path.join(imagedir, "test.gif"))
         self.assertEqual(width, 802)
         self.assertEqual(height, 670)
+
+    def test_bigendien_tiff(self):
+        width, height = imagesize.get(os.path.join(imagedir, "test.tiff"))
+        self.assertEqual(width, 802)
+        self.assertEqual(height, 670)
+
+    def test_littleendien_tiff(self):
+        width, height = imagesize.get(os.path.join(imagedir, 
"multipage_tiff_example.tif"))
+        self.assertEqual(width, 800)
+        self.assertEqual(height, 600)
Binary files old/imagesize-1.0.0/test/test_get.pyc and 
new/imagesize-1.1.0/test/test_get.pyc differ


Reply via email to