Hello community, here is the log from the commit of package python-imagesize for openSUSE:Factory checked in at 2018-02-25 12:16:55 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-imagesize (Old) and /work/SRC/openSUSE:Factory/.python-imagesize.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-imagesize" Sun Feb 25 12:16:55 2018 rev:4 rq:579326 version:1.0.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-imagesize/python-imagesize.changes 2017-04-19 18:07:55.566452077 +0200 +++ /work/SRC/openSUSE:Factory/.python-imagesize.new/python-imagesize.changes 2018-02-25 12:17:03.843064139 +0100 @@ -1,0 +2,20 @@ +Fri Feb 23 03:57:07 UTC 2018 - a...@gmx.de + +- specfile: + * update copyright year + +- update to version 1.0.0: + * Document project is stable and ready for use in production + * Skip FFC4, FFC8, FFCC markers + * Clean up all whitespace throughout project + * Include license file in the generated wheel package + * Enable pip cache in Travis CI + * Test and document all supported Python versions + * Rename [wheel] section to [bdist_wheel] as the former is legacy + * get dpi + * Add MANIFEST.in file + * Added test_suite keyword + * Created __init__.py in test directory + * Make imagesize a module + +------------------------------------------------------------------- Old: ---- imagesize-0.7.1.tar.gz New: ---- imagesize-1.0.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-imagesize.spec ++++++ --- /var/tmp/diff_new_pack.CWEYDX/_old 2018-02-25 12:17:04.659034538 +0100 +++ /var/tmp/diff_new_pack.CWEYDX/_new 2018-02-25 12:17:04.659034538 +0100 @@ -1,7 +1,7 @@ # # spec file for package python-imagesize # -# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2018 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: 0.7.1 +Version: 1.0.0 Release: 0 Summary: Getting image size from PNG/JPEG/JPEG2000/GIF files License: MIT ++++++ imagesize-0.7.1.tar.gz -> imagesize-1.0.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/imagesize-0.7.1/LICENSE.rst new/imagesize-1.0.0/LICENSE.rst --- old/imagesize-0.7.1/LICENSE.rst 1970-01-01 01:00:00.000000000 +0100 +++ new/imagesize-1.0.0/LICENSE.rst 2018-02-15 23:57:14.000000000 +0100 @@ -0,0 +1,19 @@ +The MIT License (MIT) +---------------------------- + +Copyright © 2016 Yoshiki Shibukawa + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software +and associated documentation files (the “Software”), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial +portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH +THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/imagesize-0.7.1/MANIFEST.in new/imagesize-1.0.0/MANIFEST.in --- old/imagesize-0.7.1/MANIFEST.in 1970-01-01 01:00:00.000000000 +0100 +++ new/imagesize-1.0.0/MANIFEST.in 2018-02-15 23:57:14.000000000 +0100 @@ -0,0 +1,2 @@ +include LICENSE.rst +graft test diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/imagesize-0.7.1/PKG-INFO new/imagesize-1.0.0/PKG-INFO --- old/imagesize-0.7.1/PKG-INFO 2016-04-23 03:43:56.000000000 +0200 +++ new/imagesize-1.0.0/PKG-INFO 2018-02-16 00:03:29.000000000 +0100 @@ -1,10 +1,10 @@ Metadata-Version: 1.1 Name: imagesize -Version: 0.7.1 +Version: 1.0.0 Summary: Getting image size from png/jpeg/jpeg2000/gif file Home-page: https://github.com/shibukawa/imagesize_py Author: Yoshiki Shibukawa -Author-email: yoshiki at shibu.jp +Author-email: yosh...@shibu.jp License: MIT Description: It parses image files' header and return image size. @@ -17,15 +17,20 @@ This is a pure Python library. Platform: UNKNOWN -Classifier: Development Status :: 4 - Beta +Classifier: Development Status :: 5 - Production/Stable Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: MIT License Classifier: Programming Language :: Python 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 :: Implementation :: CPython Classifier: Programming Language :: Python :: Implementation :: PyPy Classifier: Topic :: Multimedia :: Graphics diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/imagesize-0.7.1/README.rst new/imagesize-1.0.0/README.rst --- old/imagesize-0.7.1/README.rst 2016-04-23 03:34:34.000000000 +0200 +++ new/imagesize-1.0.0/README.rst 2018-02-15 23:57:14.000000000 +0100 @@ -13,7 +13,7 @@ width, height = imagesize.get("test.png") print(width, height) -This module is pure python module. +This module is a pure python module. API ----- @@ -32,7 +32,7 @@ - * module * result - - * imagesize(pure python) + - * imagesize(pure python) * 1.077 seconds per 100000 times - * Pillow * 10.569 seconds per 100000 times @@ -58,4 +58,5 @@ * shimizukawa (https://github.com/shimizukawa) * xantares (https://github.com/xantares) * Ivan Zakharyaschev (https://github.com/imz) - +* Jon Dufresne (https://github.com/jdufresne) +* Geoff Lankow (https://github.com/darktrojan) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/imagesize-0.7.1/imagesize/__init__.py new/imagesize-1.0.0/imagesize/__init__.py --- old/imagesize-0.7.1/imagesize/__init__.py 2016-04-23 03:38:44.000000000 +0200 +++ new/imagesize-1.0.0/imagesize/__init__.py 1970-01-01 01:00:00.000000000 +0100 @@ -1,7 +0,0 @@ -import sys - -__all__ = ("get",) - - -from .get import get - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/imagesize-0.7.1/imagesize/get.py new/imagesize-1.0.0/imagesize/get.py --- old/imagesize-0.7.1/imagesize/get.py 2016-04-23 03:38:44.000000000 +0200 +++ new/imagesize-1.0.0/imagesize/get.py 1970-01-01 01:00:00.000000000 +0100 @@ -1,60 +0,0 @@ -import struct - -def get(filepath): - """ - Return (width, height) for a given img file content - no requirements - """ - height = -1 - width = -1 - - with open(filepath, 'rb') as fhandle: - head = fhandle.read(24) - size = len(head) - # handle GIFs - if size >= 10 and head[:6] in (b'GIF87a', b'GIF89a'): - # Check to see if content_type is correct - try: - width, height = struct.unpack("<hh", head[6:10]) - except struct.error: - raise ValueError("Invalid GIF file") - # see png edition spec bytes are below chunk length then and finally the - elif size >= 24 and head.startswith(b'\211PNG\r\n\032\n') and head[12:16] == b'IHDR': - try: - width, height = struct.unpack(">LL", head[16:24]) - except struct.error: - raise ValueError("Invalid PNG file") - # Maybe this is for an older PNG version. - elif size >= 16 and head.startswith(b'\211PNG\r\n\032\n'): - # Check to see if we have the right content type - try: - width, height = struct.unpack(">LL", head[8:16]) - except struct.error: - raise ValueError("Invalid PNG file") - # handle JPEGs - elif size >= 2 and head.startswith(b'\377\330'): - try: - fhandle.seek(0) # Read 0xff next - size = 2 - ftype = 0 - while not 0xc0 <= ftype <= 0xcf: - fhandle.seek(size, 1) - byte = fhandle.read(1) - while ord(byte) == 0xff: - byte = fhandle.read(1) - ftype = ord(byte) - size = struct.unpack('>H', fhandle.read(2))[0] - 2 - # We are at a SOFn block - fhandle.seek(1, 1) # Skip `precision' byte. - height, width = struct.unpack('>HH', fhandle.read(4)) - except struct.error: - raise ValueError("Invalid JPEG file") - # handle JPEG2000s - elif size >= 12 and head.startswith(b'\x00\x00\x00\x0cjP \r\n\x87\n'): - fhandle.seek(48) - try: - height, width = struct.unpack('>LL', fhandle.read(8)) - except struct.error: - raise ValueError("Invalid JPEG2000 file") - return width, height - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/imagesize-0.7.1/imagesize.egg-info/PKG-INFO new/imagesize-1.0.0/imagesize.egg-info/PKG-INFO --- old/imagesize-0.7.1/imagesize.egg-info/PKG-INFO 2016-04-23 03:43:56.000000000 +0200 +++ new/imagesize-1.0.0/imagesize.egg-info/PKG-INFO 2018-02-16 00:03:29.000000000 +0100 @@ -1,10 +1,10 @@ Metadata-Version: 1.1 Name: imagesize -Version: 0.7.1 +Version: 1.0.0 Summary: Getting image size from png/jpeg/jpeg2000/gif file Home-page: https://github.com/shibukawa/imagesize_py Author: Yoshiki Shibukawa -Author-email: yoshiki at shibu.jp +Author-email: yosh...@shibu.jp License: MIT Description: It parses image files' header and return image size. @@ -17,15 +17,20 @@ This is a pure Python library. Platform: UNKNOWN -Classifier: Development Status :: 4 - Beta +Classifier: Development Status :: 5 - Production/Stable Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: MIT License Classifier: Programming Language :: Python 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 :: Implementation :: CPython Classifier: Programming Language :: Python :: Implementation :: PyPy Classifier: Topic :: Multimedia :: Graphics diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/imagesize-0.7.1/imagesize.egg-info/SOURCES.txt new/imagesize-1.0.0/imagesize.egg-info/SOURCES.txt --- old/imagesize-0.7.1/imagesize.egg-info/SOURCES.txt 2016-04-23 03:43:56.000000000 +0200 +++ new/imagesize-1.0.0/imagesize.egg-info/SOURCES.txt 2018-02-16 00:03:29.000000000 +0100 @@ -1,10 +1,18 @@ +LICENSE.rst +MANIFEST.in README.rst +imagesize.py setup.cfg setup.py -imagesize/__init__.py -imagesize/get.py imagesize.egg-info/PKG-INFO imagesize.egg-info/SOURCES.txt imagesize.egg-info/dependency_links.txt imagesize.egg-info/top_level.txt -test/test_get.py \ No newline at end of file +test/__init__.py +test/__init__.pyc +test/test_get.py +test/test_get.pyc +test/images/test.gif +test/images/test.jp2 +test/images/test.jpg +test/images/test.png \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/imagesize-0.7.1/imagesize.py new/imagesize-1.0.0/imagesize.py --- old/imagesize-0.7.1/imagesize.py 1970-01-01 01:00:00.000000000 +0100 +++ new/imagesize-1.0.0/imagesize.py 2018-02-15 23:57:14.000000000 +0100 @@ -0,0 +1,204 @@ +import struct + +_UNIT_KM = -3 +_UNIT_100M = -2 +_UNIT_10M = -1 +_UNIT_1M = 0 +_UNIT_10CM = 1 +_UNIT_CM = 2 +_UNIT_MM = 3 +_UNIT_0_1MM = 4 +_UNIT_0_01MM = 5 +_UNIT_UM = 6 +_UNIT_INCH = 6 + +def _convertToDPI(density, unit): + if unit == _UNIT_KM: + return int(density * 0.0000254 + 0.5) + elif unit == _UNIT_100M: + return int(density * 0.000254 + 0.5) + elif unit == _UNIT_10M: + return int(density * 0.00254 + 0.5) + elif unit == _UNIT_1M: + return int(density * 0.0254 + 0.5) + elif unit == _UNIT_10CM: + return int(density * 0.254 + 0.5) + elif unit == _UNIT_CM: + return int(density * 2.54 + 0.5) + elif unit == _UNIT_MM: + return int(density * 25.4 + 0.5) + elif unit == _UNIT_0_1MM: + return density * 254 + elif unit == _UNIT_0_01MM: + return density * 2540 + elif unit == _UNIT_UM: + return density * 25400 + return density + +def get(filepath): + """ + Return (width, height) for a given img file content + no requirements + """ + height = -1 + width = -1 + + with open(filepath, 'rb') as fhandle: + head = fhandle.read(24) + size = len(head) + # handle GIFs + if size >= 10 and head[:6] in (b'GIF87a', b'GIF89a'): + # Check to see if content_type is correct + try: + width, height = struct.unpack("<hh", head[6:10]) + except struct.error: + raise ValueError("Invalid GIF file") + # see png edition spec bytes are below chunk length then and finally the + elif size >= 24 and head.startswith(b'\211PNG\r\n\032\n') and head[12:16] == b'IHDR': + try: + width, height = struct.unpack(">LL", head[16:24]) + except struct.error: + raise ValueError("Invalid PNG file") + # Maybe this is for an older PNG version. + elif size >= 16 and head.startswith(b'\211PNG\r\n\032\n'): + # Check to see if we have the right content type + try: + width, height = struct.unpack(">LL", head[8:16]) + except struct.error: + raise ValueError("Invalid PNG file") + # handle JPEGs + elif size >= 2 and head.startswith(b'\377\330'): + try: + fhandle.seek(0) # Read 0xff next + size = 2 + ftype = 0 + while not 0xc0 <= ftype <= 0xcf or ftype in [0xc4, 0xc8, 0xcc]: + fhandle.seek(size, 1) + byte = fhandle.read(1) + while ord(byte) == 0xff: + byte = fhandle.read(1) + ftype = ord(byte) + size = struct.unpack('>H', fhandle.read(2))[0] - 2 + # We are at a SOFn block + fhandle.seek(1, 1) # Skip `precision' byte. + height, width = struct.unpack('>HH', fhandle.read(4)) + except struct.error: + raise ValueError("Invalid JPEG file") + # handle JPEG2000s + elif size >= 12 and head.startswith(b'\x00\x00\x00\x0cjP \r\n\x87\n'): + fhandle.seek(48) + try: + height, width = struct.unpack('>LL', fhandle.read(8)) + except struct.error: + raise ValueError("Invalid JPEG2000 file") + return width, height + +def getDPI(filepath): + """ + Return (width, height) for a given img file content + no requirements + """ + xDPI = -1 + yDPI = -1 + with open(filepath, 'rb') as fhandle: + head = fhandle.read(24) + size = len(head) + # handle GIFs + # GIFs doesn't have density + if size >= 10 and head[:6] in (b'GIF87a', b'GIF89a'): + pass + # see png edition spec bytes are below chunk length then and finally the + elif size >= 24 and head.startswith(b'\211PNG\r\n\032\n'): + chunkOffset = 8 + chunk = head[8:] + while True: + chunkType = chunk[4:8] + if chunkType == b'pHYs': + try: + xDensity, yDensity, unit = struct.unpack(">LLB", chunk[8:]) + except struct.error: + raise ValueError("Invalid PNG file") + if unit: + xDPI = _convertToDPI(xDensity, _UNIT_1M) + yDPI = _convertToDPI(yDensity, _UNIT_1M) + else: # no unit + xDPI = xDensity + yDPI = yDensity + break + elif chunkType == b'IDAT': + break + else: + try: + dataSize, = struct.unpack(">L", chunk[0:4]) + except struct.error: + raise ValueError("Invalid PNG file") + chunkOffset += dataSize + 12 + fhandle.seek(chunkOffset) + chunk = fhandle.read(17) + # handle JPEGs + elif size >= 2 and head.startswith(b'\377\330'): + try: + fhandle.seek(0) # Read 0xff next + size = 2 + ftype = 0 + while not 0xc0 <= ftype <= 0xcf: + if ftype == 0xe0: # APP0 marker + fhandle.seek(7, 1) + unit, xDensity, yDensity = struct.unpack(">BHH", fhandle.read(5)) + if unit == 1 or unit == 0: + xDPI = xDensity + yDPI = yDensity + elif unit == 2: + xDPI = _convertToDPI(xDensity, _UNIT_CM) + yDPI = _convertToDPI(yDensity, _UNIT_CM) + break + fhandle.seek(size, 1) + byte = fhandle.read(1) + while ord(byte) == 0xff: + byte = fhandle.read(1) + ftype = ord(byte) + size = struct.unpack('>H', fhandle.read(2))[0] - 2 + except struct.error: + raise ValueError("Invalid JPEG file") + # handle JPEG2000s + elif size >= 12 and head.startswith(b'\x00\x00\x00\x0cjP \r\n\x87\n'): + fhandle.seek(32) + # skip JP2 image header box + headerSize = struct.unpack('>L', fhandle.read(4))[0] - 8 + fhandle.seek(4, 1) + 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 + 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") + 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-0.7.1/setup.cfg new/imagesize-1.0.0/setup.cfg --- old/imagesize-0.7.1/setup.cfg 2016-04-23 03:43:56.000000000 +0200 +++ new/imagesize-1.0.0/setup.cfg 2018-02-16 00:03:29.000000000 +0100 @@ -1,6 +1,9 @@ -[wheel] +[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-0.7.1/setup.py new/imagesize-1.0.0/setup.py --- old/imagesize-0.7.1/setup.py 2016-04-23 03:20:04.000000000 +0200 +++ new/imagesize-1.0.0/setup.py 2018-02-16 00:03:11.000000000 +0100 @@ -4,7 +4,7 @@ #from distutils.core import setup setup(name='imagesize', - version='0.7.1', + version='1.0.0', description='Getting image size from png/jpeg/jpeg2000/gif file', long_description=''' It parses image files' header and return image size. @@ -17,22 +17,27 @@ This is a pure Python library. ''', author='Yoshiki Shibukawa', - author_email='yoshiki at shibu.jp', + author_email='yosh...@shibu.jp', url='https://github.com/shibukawa/imagesize_py', license="MIT", - packages=['imagesize'], - package_dir={"imagesize": "imagesize"}, + py_modules=['imagesize'], + test_suite='test', classifiers = [ - 'Development Status :: 4 - Beta', + 'Development Status :: 5 - Production/Stable', 'Intended Audience :: Developers', 'License :: OSI Approved :: MIT License', 'Programming Language :: Python', '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 :: Implementation :: CPython', 'Programming Language :: Python :: Implementation :: PyPy', 'Topic :: Multimedia :: Graphics' ] Binary files old/imagesize-0.7.1/test/__init__.pyc and new/imagesize-1.0.0/test/__init__.pyc differ Binary files old/imagesize-0.7.1/test/images/test.gif and new/imagesize-1.0.0/test/images/test.gif differ Binary files old/imagesize-0.7.1/test/images/test.jp2 and new/imagesize-1.0.0/test/images/test.jp2 differ Binary files old/imagesize-0.7.1/test/images/test.jpg and new/imagesize-1.0.0/test/images/test.jpg differ Binary files old/imagesize-0.7.1/test/images/test.png and new/imagesize-1.0.0/test/images/test.png differ Binary files old/imagesize-0.7.1/test/test_get.pyc and new/imagesize-1.0.0/test/test_get.pyc differ