From 70cf8c9431ee3c7b31e27d6684dd6dd8028dfe74 Mon Sep 17 00:00:00 2001 From: hugovk Date: Thu, 21 Aug 2014 13:46:58 +0300 Subject: [PATCH 01/10] Update WebP from 0.4.0 to 0.4.1 --- depends/install_webp.sh | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/depends/install_webp.sh b/depends/install_webp.sh index 5f5963712..14758f6b8 100755 --- a/depends/install_webp.sh +++ b/depends/install_webp.sh @@ -1,18 +1,15 @@ #!/bin/bash # install webp - -if [ ! -f libwebp-0.4.0.tar.gz ]; then - wget 'https://webp.googlecode.com/files/libwebp-0.4.0.tar.gz' +if [ ! -f libwebp-0.4.1.tar.gz ]; then + wget 'http://downloads.webmproject.org/releases/webp/libwebp-0.4.1.tar.gz' fi -rm -r libwebp-0.4.0 -tar -xvzf libwebp-0.4.0.tar.gz +rm -r libwebp-0.4.1 +tar -xvzf libwebp-0.4.1.tar.gz - -pushd libwebp-0.4.0 +pushd libwebp-0.4.1 ./configure --prefix=/usr --enable-libwebpmux --enable-libwebpdemux && make && sudo make install popd - From 30680bb384368425e03ed4e7bd8a7fba9f63e819 Mon Sep 17 00:00:00 2001 From: hugovk Date: Thu, 21 Aug 2014 14:02:48 +0300 Subject: [PATCH 02/10] Make WebP with 4 job slots - ~2.4 times faster --- depends/install_webp.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/depends/install_webp.sh b/depends/install_webp.sh index 14758f6b8..7810159cc 100755 --- a/depends/install_webp.sh +++ b/depends/install_webp.sh @@ -10,6 +10,6 @@ tar -xvzf libwebp-0.4.1.tar.gz pushd libwebp-0.4.1 -./configure --prefix=/usr --enable-libwebpmux --enable-libwebpdemux && make && sudo make install +./configure --prefix=/usr --enable-libwebpmux --enable-libwebpdemux && make -j4 && sudo make -j4 install popd From 4b8b91965a72ed1eb37847092a2a26330822d0b8 Mon Sep 17 00:00:00 2001 From: hugovk Date: Thu, 21 Aug 2014 14:11:35 +0300 Subject: [PATCH 03/10] Make OpenJPEG with 4 job slots - ~2.2 times faster --- depends/install_openjpeg.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/depends/install_openjpeg.sh b/depends/install_openjpeg.sh index b3a6ccc4d..ddff45c1e 100755 --- a/depends/install_openjpeg.sh +++ b/depends/install_openjpeg.sh @@ -11,9 +11,9 @@ rm -r openjpeg-2.1.0 tar -xvzf openjpeg-2.1.0.tar.gz -pushd openjpeg-2.1.0 +pushd openjpeg-2.1.0 -cmake -DCMAKE_INSTALL_PREFIX=/usr . && make && sudo make install +cmake -DCMAKE_INSTALL_PREFIX=/usr . && make -j 4 && sudo make -j 4 install popd From d0ec73602b08edad601544fd44b5cf87230ada83 Mon Sep 17 00:00:00 2001 From: hugovk Date: Thu, 21 Aug 2014 14:50:11 +0300 Subject: [PATCH 04/10] Make OpenJPEG with 4 job slots - ~2.2 times faster (take 2) --- depends/install_openjpeg.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/depends/install_openjpeg.sh b/depends/install_openjpeg.sh index ddff45c1e..83620f4b8 100755 --- a/depends/install_openjpeg.sh +++ b/depends/install_openjpeg.sh @@ -13,7 +13,7 @@ tar -xvzf openjpeg-2.1.0.tar.gz pushd openjpeg-2.1.0 -cmake -DCMAKE_INSTALL_PREFIX=/usr . && make -j 4 && sudo make -j 4 install +cmake -DCMAKE_INSTALL_PREFIX=/usr . && make -j4 && sudo make -j4 install popd From 9d00686f53296e7aafa9bd66789e7dce7367cc96 Mon Sep 17 00:00:00 2001 From: wiredfool Date: Fri, 22 Aug 2014 16:14:48 -0700 Subject: [PATCH 05/10] backup implementation of Round for windows platforms --- libImaging/Convert.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libImaging/Convert.c b/libImaging/Convert.c index 46a6cfb72..3d9119c7f 100644 --- a/libImaging/Convert.c +++ b/libImaging/Convert.c @@ -49,6 +49,12 @@ #define L(rgb)\ ((INT32) (rgb)[0]*299 + (INT32) (rgb)[1]*587 + (INT32) (rgb)[2]*114) +#ifndef round +double round(double x) { + return floor(x+0.5); +} +#endif + /* ------------------- */ /* 1 (bit) conversions */ /* ------------------- */ From 1d58e711fede7059a9299a21f6121b9d41d44380 Mon Sep 17 00:00:00 2001 From: wiredfool Date: Fri, 22 Aug 2014 16:15:22 -0700 Subject: [PATCH 06/10] mp is a little twitchy on windows --- mp_compile.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mp_compile.py b/mp_compile.py index b7c3e7ce4..adbac7c19 100644 --- a/mp_compile.py +++ b/mp_compile.py @@ -3,7 +3,7 @@ from multiprocessing import Pool, cpu_count from distutils.ccompiler import CCompiler -import os +import os, sys try: MAX_PROCS = int(os.environ.get('MAX_CONCURRENCY', cpu_count())) @@ -50,7 +50,7 @@ def _mp_compile(self, sources, output_dir=None, macros=None, return objects # explicitly don't enable if environment says 1 processor -if MAX_PROCS != 1: +if MAX_PROCS != 1 and not sys.platform.startswith('win'): try: # bug, only enable if we can make a Pool. see issue #790 and # http://stackoverflow.com/questions/6033599/oserror-38-errno-38-with-multiprocessing From 136345a5a57afb76d15090e4ec9296659e59e003 Mon Sep 17 00:00:00 2001 From: wiredfool Date: Fri, 22 Aug 2014 17:04:26 -0700 Subject: [PATCH 07/10] allowing for libwebp* library names --- setup.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 5cf0e5e65..8c46d7a0e 100644 --- a/setup.py +++ b/setup.py @@ -487,6 +487,8 @@ class pil_build_ext(build_ext): # In Google's precompiled zip it is call "libwebp": if _find_library_file(self, "webp"): feature.webp = "webp" + elif _find_library_file(self, "libwebp"): + feature.webp = "libwebp" if feature.want('webpmux'): if (_find_include_file(self, "webp/mux.h") and @@ -494,6 +496,9 @@ class pil_build_ext(build_ext): if (_find_library_file(self, "webpmux") and _find_library_file(self, "webpdemux")): feature.webpmux = "webpmux" + if (_find_library_file(self, "libwebpmux") and + _find_library_file(self, "libwebpdemux")): + feature.webpmux = "libwebpmux" for f in feature: if not getattr(feature, f) and feature.require(f): @@ -559,13 +564,13 @@ class pil_build_ext(build_ext): libraries=["lcms2"] + extra)) if os.path.isfile("_webp.c") and feature.webp: - libs = ["webp"] + libs = [feature.webp] defs = [] if feature.webpmux: defs.append(("HAVE_WEBPMUX", None)) - libs.append("webpmux") - libs.append("webpdemux") + libs.append(feature.webpmux) + libs.append(feature.webpmux.replace('pmux','pdemux')) exts.append(Extension( "PIL._webp", ["_webp.c"], libraries=libs, define_macros=defs)) From 566448fbf0b2bb296c00664b65919039945c5c34 Mon Sep 17 00:00:00 2001 From: Hugo Date: Tue, 26 Aug 2014 09:17:54 +0300 Subject: [PATCH 08/10] Update CHANGES.rst [CI skip] --- CHANGES.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index 97bbd5d86..c068013a6 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -4,6 +4,9 @@ Changelog (Pillow) 2.6.0 (unreleased) ------------------ +- Windows fixes #871 + [wiredfool] + - Fix TGA files with image ID field #856 [megabuz] From 3e361d800d99f056324e502c869f957076237f18 Mon Sep 17 00:00:00 2001 From: wiredfool Date: Tue, 26 Aug 2014 09:57:15 -0700 Subject: [PATCH 09/10] Refactor inheritance tree of test_file_libtiff_small --- Tests/test_file_libtiff.py | 5 +++-- Tests/test_file_libtiff_small.py | 6 ++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/Tests/test_file_libtiff.py b/Tests/test_file_libtiff.py index 60eea8b3b..b5df39d04 100644 --- a/Tests/test_file_libtiff.py +++ b/Tests/test_file_libtiff.py @@ -4,8 +4,7 @@ import os from PIL import Image, TiffImagePlugin - -class TestFileLibTiff(PillowTestCase): +class LibTiffTestCase(PillowTestCase): def setUp(self): codecs = dir(Image.core) @@ -32,6 +31,8 @@ class TestFileLibTiff(PillowTestCase): out = self.tempfile("temp.png") im.save(out) +class TestFileLibTiff(LibTiffTestCase): + def test_g4_tiff(self): """Test the ordinary file path load path""" diff --git a/Tests/test_file_libtiff_small.py b/Tests/test_file_libtiff_small.py index 043ecaf3f..9c73ee5c2 100644 --- a/Tests/test_file_libtiff_small.py +++ b/Tests/test_file_libtiff_small.py @@ -2,12 +2,10 @@ from helper import unittest from PIL import Image -from test_file_libtiff import TestFileLibTiff +from test_file_libtiff import LibTiffTestCase -class TestFileLibTiffSmall(TestFileLibTiff): - - # Inherits TestFileLibTiff's setUp() and self._assert_noerr() +class TestFileLibTiffSmall(LibTiffTestCase): """ The small lena image was failing on open in the libtiff decoder because the file pointer was set to the wrong place From 8b2e7ee48ac9317b79bb7f0053a9201ada8d7d08 Mon Sep 17 00:00:00 2001 From: wiredfool Date: Tue, 26 Aug 2014 14:48:17 -0700 Subject: [PATCH 10/10] Additional dependencies [ci skip] --- Tests/README.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Tests/README.rst b/Tests/README.rst index 1b11a45b1..6fd770f55 100644 --- a/Tests/README.rst +++ b/Tests/README.rst @@ -10,6 +10,9 @@ Install:: pip install coverage nose +If you're using Python 2.6, there's one additional dependency:: + + pip install unittest2 Execution ---------