diff --git a/CHANGES.rst b/CHANGES.rst index a91e4be5c..c8f39899d 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -3,6 +3,16 @@ Changelog (Pillow) 2.9.0 (Unreleased) ------------------ + +- Fixed tox test script path #1308 + [radarhere] + +- Added width and height properties #1304 + [radarhere] + +- Update tiff and tk tcl 8.5 versions #1303 + [radarhere, wiredfool] + - Add functions to convert: Image <-> QImage; Image <-> QPixmap #1217 [radarhere, rominf] diff --git a/MANIFEST.in b/MANIFEST.in index 30e73c075..ad5bc3bed 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,14 +1,16 @@ + include *.c include *.h +include *.in include *.md include *.py -include *.sh include *.rst +include *.sh include *.txt include *.yaml +include *.yml include .coveragerc include .gitattributes -include .travis.yml include LICENSE include Makefile include tox.ini @@ -16,7 +18,6 @@ recursive-include PIL *.md recursive-include Scripts *.py recursive-include Scripts *.rst recursive-include Scripts *.sh -recursive-include Scripts README.rst recursive-include Tests *.bdf recursive-include Tests *.bin recursive-include Tests *.bmp @@ -33,11 +34,13 @@ recursive-include Tests *.html recursive-include Tests *.icc recursive-include Tests *.icns recursive-include Tests *.ico +recursive-include Tests *.im recursive-include Tests *.j2k recursive-include Tests *.jp2 recursive-include Tests *.jpg recursive-include Tests *.lut recursive-include Tests *.mpo +recursive-include Tests *.msp recursive-include Tests *.pbm recursive-include Tests *.pcf recursive-include Tests *.pcx @@ -59,8 +62,8 @@ recursive-include Tests *.tiff recursive-include Tests *.ttf recursive-include Tests *.txt recursive-include Tests *.webp +recursive-include Tests *.xbm recursive-include Tests *.xpm -recursive-include Tests *.msp recursive-include Tk *.c recursive-include Tk *.rst recursive-include depends *.rst @@ -71,9 +74,13 @@ recursive-include docs *.html recursive-include docs *.py recursive-include docs *.rst recursive-include docs *.txt -recursive-include docs BUILDME -recursive-include docs COPYING -recursive-include docs Guardfile recursive-include docs Makefile +recursive-include docs Guardfile +recursive-include docs COPYING +recursive-include docs BUILDME recursive-include libImaging *.c recursive-include libImaging *.h +recursive-include winbuild *.gitignore +recursive-include winbuild *.md +recursive-include winbuild *.opt +recursive-include winbuild *.py diff --git a/Makefile b/Makefile index 4d96c497d..e123a74c7 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,6 @@ # https://www.gnu.org/software/make/manual/html_node/Phony-Targets.html .PHONY: clean coverage doc docserve help inplace install install-req release-test sdist test upload upload-test +.DEFAULT_GOAL := release-test clean: python setup.py clean diff --git a/PIL/Image.py b/PIL/Image.py index a6b08d196..3740b51c6 100644 --- a/PIL/Image.py +++ b/PIL/Image.py @@ -504,6 +504,14 @@ class Image(object): self.readonly = 0 self.pyaccess = None + @property + def width(self): + return self.size[0] + + @property + def height(self): + return self.size[1] + def _new(self, im): new = Image() new.im = im diff --git a/PIL/TiffImagePlugin.py b/PIL/TiffImagePlugin.py index 59de84273..83bbd3f93 100644 --- a/PIL/TiffImagePlugin.py +++ b/PIL/TiffImagePlugin.py @@ -548,7 +548,7 @@ class ImageFileDirectory(collections.MutableMapping): # and doesn't match the tiff spec: 8-bit byte that # contains a 7-bit ASCII code; the last byte must be # NUL (binary zero). Also, I don't think this was well - # excersized before. + # exercised before. data = value = b"" + value.encode('ascii', 'replace') + b"\0" else: # integer data diff --git a/Tests/test_image.py b/Tests/test_image.py index 469045909..bd5fd3522 100644 --- a/Tests/test_image.py +++ b/Tests/test_image.py @@ -30,6 +30,15 @@ class TestImage(PillowTestCase): # self.assertRaises( # MemoryError, lambda: Image.new("L", (1000000, 1000000))) + def test_width_height(self): + im = Image.new("RGB", (1, 2)) + self.assertEqual(im.width, 1) + self.assertEqual(im.height, 2) + + im.size = (3, 4) + self.assertEqual(im.width, 3) + self.assertEqual(im.height, 4) + def test_invalid_image(self): if str is bytes: import StringIO diff --git a/appveyor.yml b/appveyor.yml index 868f34f7e..179c329a8 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,5 +1,4 @@ version: 2.9.pre.{build} -shallow_clone: true clone_folder: c:\pillow init: - ECHO %PYTHON% diff --git a/docs/reference/Image.rst b/docs/reference/Image.rst index 974d84a6e..ac8b6f506 100644 --- a/docs/reference/Image.rst +++ b/docs/reference/Image.rst @@ -181,6 +181,18 @@ Instances of the :py:class:`Image` class have the following attributes: :type: ``(width, height)`` +.. py:attribute:: width + + Image width, in pixels. + + :type: :py:class:`int` + +.. py:attribute:: height + + Image height, in pixels. + + :type: :py:class:`int` + .. py:attribute:: palette Colour palette table, if any. If mode is ā€œPā€, this should be an instance of diff --git a/tox.ini b/tox.ini index 80f7edef4..ebc63d85a 100644 --- a/tox.ini +++ b/tox.ini @@ -11,4 +11,4 @@ commands = {envpython} setup.py clean {envpython} setup.py build_ext --inplace {envpython} selftest.py - {envpython} Tests/run.py --installed + {envpython} test-installed.py --installed diff --git a/winbuild/build_dep.py b/winbuild/build_dep.py index a837b31f5..2ca4613c7 100644 --- a/winbuild/build_dep.py +++ b/winbuild/build_dep.py @@ -91,18 +91,19 @@ endlocal """ % compiler -def cp_tk(): +def cp_tk(ver_85, ver_86): + versions = {'ver_85':ver_85, 'ver_86':ver_86} return r""" -mkdir %INCLIB%\tcl85\include\X11 -copy /Y /B %BUILD%\tcl8.5.13\generic\*.h %INCLIB%\tcl85\include\ -copy /Y /B %BUILD%\tk8.5.13\generic\*.h %INCLIB%\tcl85\include\ -copy /Y /B %BUILD%\tk8.5.13\xlib\X11\* %INCLIB%\tcl85\include\X11\ +mkdir %%INCLIB%%\tcl85\include\X11 +copy /Y /B %%BUILD%%\tcl%(ver_85)s\generic\*.h %%INCLIB%%\tcl85\include\ +copy /Y /B %%BUILD%%\tk%(ver_85)s\generic\*.h %%INCLIB%%\tcl85\include\ +copy /Y /B %%BUILD%%\tk%(ver_85)s\xlib\X11\* %%INCLIB%%\tcl85\include\X11\ -mkdir %INCLIB%\tcl86\include\X11 -copy /Y /B %BUILD%\tcl8.6.4\generic\*.h %INCLIB%\tcl86\include\ -copy /Y /B %BUILD%\tk8.6.4\generic\*.h %INCLIB%\tcl86\include\ -copy /Y /B %BUILD%\tk8.6.4\xlib\X11\* %INCLIB%\tcl86\include\X11\ -""" +mkdir %%INCLIB%%\tcl86\include\X11 +copy /Y /B %%BUILD%%\tcl%(ver_86)s\generic\*.h %%INCLIB%%\tcl86\include\ +copy /Y /B %%BUILD%%\tk%(ver_86)s\generic\*.h %%INCLIB%%\tcl86\include\ +copy /Y /B %%BUILD%%\tk%(ver_86)s\xlib\X11\* %%INCLIB%%\tcl86\include\X11\ +""" % versions def header(): @@ -305,7 +306,7 @@ def add_compiler(compiler): mkdirs() fetch_libs() # extract_binlib() -script = [header(), cp_tk()] +script = [header(), cp_tk(libs['tk-8.5']['version'],libs['tk-8.6']['version'] )] if 'PYTHON' in os.environ: diff --git a/winbuild/config.py b/winbuild/config.py index ffd8079fe..f19a881f5 100644 --- a/winbuild/config.py +++ b/winbuild/config.py @@ -22,9 +22,9 @@ libs = {'zlib': { 'dir': 'jpeg-9a', }, 'tiff': { - 'url': 'ftp://ftp.remotesensing.org/pub/libtiff/tiff-4.0.3.zip', - 'hash': 'md5:dd70349cedb3981371686e1c9b89a7f9', # not found - generated by wiredfool - 'dir': 'tiff-4.0.3', + 'url': 'ftp://ftp.remotesensing.org/pub/libtiff/tiff-4.0.4.zip', + 'hash': 'md5:8f538a34156188f9a8dcddb679c65d1e', + 'dir': 'tiff-4.0.4', }, 'freetype': { 'url': 'http://download.savannah.gnu.org/releases/freetype/freetype-2.6.tar.gz', @@ -37,14 +37,15 @@ libs = {'zlib': { 'dir': 'lcms2-2.7', }, 'tcl-8.5': { - 'url': SF_MIRROR+'/project/tcl/Tcl/8.5.13/tcl8513-src.zip', - 'hash': 'sha1:3e01585c91293c532a3cd594ec59deca92153a5e', + 'url': SF_MIRROR+'/project/tcl/Tcl/8.5.18/tcl8518-src.zip', + 'hash': 'sha1:4c2aed9043088c630a4c795265e2738ef1b4db3b', 'dir': '', }, 'tk-8.5': { - 'url': SF_MIRROR+'/project/tcl/Tcl/8.5.13/tk8513-src.zip', - 'hash': 'sha1:23a1d7ddd416e11e06dfdb9f86111d4bab9420b4', + 'url': SF_MIRROR+'/project/tcl/Tcl/8.5.18/tk8518-src.zip', + 'hash': 'sha1:273f55148777413774aa722ecad25cabda1e31ae', 'dir': '', + 'version':'8.5.18', }, 'tcl-8.6': { 'url': SF_MIRROR+'/project/tcl/Tcl/8.6.4/tcl864-src.zip', @@ -55,12 +56,13 @@ libs = {'zlib': { 'url': SF_MIRROR+'/project/tcl/Tcl/8.6.4/tk864-src.zip', 'hash': 'md5:111d45061a69e7f5250b6ec8ca7c4f35', 'dir': '', + 'version':'8.6.4', }, 'webp': { 'url': 'http://downloads.webmproject.org/releases/webp/libwebp-0.4.3.tar.gz', 'hash': 'sha1:1c307a61c4d0018620b4ba9a58e8f48a8d6640ef', 'dir': 'libwebp-0.4.3', - + }, 'openjpeg': { 'url': SF_MIRROR+'/project/openjpeg/openjpeg/2.1.0/openjpeg-2.1.0.tar.gz', @@ -68,7 +70,7 @@ libs = {'zlib': { 'dir': 'openjpeg-2.1.0', }, - } +} bin_libs = { 'openjpeg': {