diff --git a/.travis.yml b/.travis.yml index f2a783d..5ee7806 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,7 +15,7 @@ before_install: - sudo apt-get install python-numpy python-opencv python-pycurl install: - if [[ $TRAVIS_PYTHON_VERSION == '2.6' ]]; then pip install unittest2; fi - - pip install tornado==4.0.2 Pillow==2.8.1 coveralls + - pip install tornado==4.5.1 Pillow==2.9.0 coveralls - pip install pep8==1.6.2 pyflakes==0.8.1 before_script: - pep8 --exclude=test pilbox diff --git a/CHANGES.txt b/CHANGES.txt index cd69600..c2d482a 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -54,3 +54,4 @@ * 1.2.1: Added max operations config property * 1.2.2: Added max resize width and height config properties * 1.2.3: Added user_agent option + * 1.3.0: Increased Pillow to 4.1.0 and Tornado to 4.5.1 diff --git a/README.rst b/README.rst index 561318b..8bc769f 100644 --- a/README.rst +++ b/README.rst @@ -31,9 +31,9 @@ Setup Dependencies ------------ -- >= `Python 2.7 `_ -- `Pillow 2.8.1 `_ -- `Tornado 4.0.2 `_ +- `Python >= 2.7 `_ +- `Pillow 4.1.0 `_ +- `Tornado 2.9.0 `_ - `OpenCV 2.x `_ (optional) - `PycURL 7.x `_ (optional, but recommended; required for proxy requests and requests over TLS) @@ -631,3 +631,4 @@ Changelog - 1.2.1: Added max operations config property - 1.2.2: Added max resize width and height config properties - 1.2.3: Added user_agent option +- 1.3.0: Increased Pillow to 2.9.0 and Tornado to 4.5.1 diff --git a/pilbox/__init__.py b/pilbox/__init__.py index ff17144..f51c1c7 100644 --- a/pilbox/__init__.py +++ b/pilbox/__init__.py @@ -77,13 +77,14 @@ * 1.2.1: Added max operations config property * 1.2.2: Added max resize width and height config properties * 1.2.3: Added user_agent option + * 1.3.0: Increased Pillow to 2.9.0 and Tornado to 4.5.1 """ # human-readable version number -version = "1.2.3" +version = "1.3.0" # The first three numbers are the components of the version number. # The fourth is zero for an official release, positive for a development # branch, or negative for a release candidate or beta (after the base version # number has been incremented) -version_info = (1, 2, 3, 0) +version_info = (1, 3, 0, 0) diff --git a/pilbox/image.py b/pilbox/image.py index 47fa307..6c86edc 100644 --- a/pilbox/image.py +++ b/pilbox/image.py @@ -224,8 +224,17 @@ def rotate(self, deg, **kwargs): else: deg = 0 - expand = False if int(deg) % 90 == 0 else bool(int(opts["expand"])) - self.img = self.img.rotate(360 - int(deg), expand=expand) + deg = 360 - (int(deg) % 360) + if deg % 90 == 0: + if deg == 90: + self.img = self.img.transpose(PIL.Image.ROTATE_90) + elif deg == 180: + self.img = self.img.transpose(PIL.Image.ROTATE_180) + elif deg == 270: + self.img = self.img.transpose(PIL.Image.ROTATE_270) + else: + self.img = self.img.rotate(deg, expand=bool(int(opts["expand"]))) + return self def save(self, **kwargs): @@ -376,7 +385,7 @@ def _get_face_classifier(self): def _pil_to_opencv(self): mono = self.img.convert("L") cvim = cv.CreateImageHeader(mono.size, cv.IPL_DEPTH_8U, 1) - cv.SetData(cvim, mono.tostring(), mono.size[0]) + cv.SetData(cvim, mono.tobytes(), mono.size[0]) cv.EqualizeHist(cvim, cvim) return cvim diff --git a/pilbox/test/data/expected/test5-100x200-mode=clip.gif b/pilbox/test/data/expected/test5-100x200-mode=clip.gif index 5675b75..4e3d2e3 100644 Binary files a/pilbox/test/data/expected/test5-100x200-mode=clip.gif and b/pilbox/test/data/expected/test5-100x200-mode=clip.gif differ diff --git a/pilbox/test/data/expected/test5-100x200-mode=scale.gif b/pilbox/test/data/expected/test5-100x200-mode=scale.gif index d50e581..2341f37 100644 Binary files a/pilbox/test/data/expected/test5-100x200-mode=scale.gif and b/pilbox/test/data/expected/test5-100x200-mode=scale.gif differ diff --git a/pilbox/test/data/expected/test5-300x300-mode=clip.gif b/pilbox/test/data/expected/test5-300x300-mode=clip.gif index 55890bf..51ca7d8 100644 Binary files a/pilbox/test/data/expected/test5-300x300-mode=clip.gif and b/pilbox/test/data/expected/test5-300x300-mode=clip.gif differ diff --git a/pilbox/test/data/expected/test5-300x300-mode=scale.gif b/pilbox/test/data/expected/test5-300x300-mode=scale.gif index 193445e..5d8bdae 100644 Binary files a/pilbox/test/data/expected/test5-300x300-mode=scale.gif and b/pilbox/test/data/expected/test5-300x300-mode=scale.gif differ diff --git a/pilbox/test/data/expected/test5-400x300-mode=clip.gif b/pilbox/test/data/expected/test5-400x300-mode=clip.gif index c3eaa21..8fcbcc8 100644 Binary files a/pilbox/test/data/expected/test5-400x300-mode=clip.gif and b/pilbox/test/data/expected/test5-400x300-mode=clip.gif differ diff --git a/pilbox/test/data/expected/test5-400x300-mode=scale.gif b/pilbox/test/data/expected/test5-400x300-mode=scale.gif index 0335695..89ae77e 100644 Binary files a/pilbox/test/data/expected/test5-400x300-mode=scale.gif and b/pilbox/test/data/expected/test5-400x300-mode=scale.gif differ diff --git a/provisioning/playbook.yml b/provisioning/playbook.yml index bc2061a..8f277a8 100644 --- a/provisioning/playbook.yml +++ b/provisioning/playbook.yml @@ -51,8 +51,8 @@ version={{ item.version }} use_mirrors=yes with_items: - - { name: 'Pillow', version: '2.8.1' } - - { name: 'tornado', version: '4.0.2' } + - { name: 'Pillow', version: '2.9.0' } + - { name: 'tornado', version: '4.5.1' } - { name: 'coverage', version: '3.6' } - { name: 'pep8', version: '1.6.2' } - { name: 'pyflakes', version: '0.8.1' } diff --git a/setup.py b/setup.py index 54fba56..26f16cd 100644 --- a/setup.py +++ b/setup.py @@ -21,7 +21,7 @@ def run(self): setup(name='pilbox', - version='1.2.3', + version='1.3.0', description='Pilbox is an image processing application server built on the Tornado web framework using the Pillow Imaging Library', long_description=readme, classifiers=[ @@ -43,8 +43,8 @@ def run(self): 'pilbox': ['frontalface.xml'], }, install_requires=[ - 'tornado==4.0.2', - 'Pillow==2.8.1', + 'tornado==4.5.1', + 'Pillow==2.9.0', 'sphinx-me==0.2.1', ], extras_require = {