[Python-modules-commits] [pilkit] 01/08: Import pilkit_2.0.orig.tar.gz

Michael Fladischer fladi at moszumanska.debian.org
Fri Mar 10 08:26:20 UTC 2017


This is an automated email from the git hooks/post-receive script.

fladi pushed a commit to branch master
in repository pilkit.

commit db79d70dad5ceb3761c747d35d9c3a0fc869d060
Author: Michael Fladischer <FladischerMichael at fladi.at>
Date:   Fri Mar 10 09:11:19 2017 +0100

    Import pilkit_2.0.orig.tar.gz
---
 AUTHORS                       |   2 ++
 MANIFEST.in                   |   2 +-
 PKG-INFO                      |  10 ++++++----
 README.rst                    |   1 +
 pilkit.egg-info/PKG-INFO      |  10 ++++++----
 pilkit.egg-info/SOURCES.txt   |  17 ++---------------
 pilkit/pkgmeta.py             |   2 +-
 pilkit/processors/__init__.py |   1 +
 pilkit/processors/overlay.py  |  23 +++++++++++++++++++++++
 pilkit/utils.py               |   9 ++++++++-
 setup.py                      |  13 +++++++------
 tests/assets/reference.png    | Bin 0 -> 119422 bytes
 tests/test_processors.py      |  14 ++++++++++++--
 tests/utils.py                |   2 +-
 14 files changed, 71 insertions(+), 35 deletions(-)

diff --git a/AUTHORS b/AUTHORS
index 2be9739..9556eb8 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -5,6 +5,7 @@ Maintainers
 * `Matthew Tretter`_
 * `Chris Drackett`_
 * `Greg Newman`_
+* `Venelin Stoykov`_
 
 
 Contributors
@@ -29,6 +30,7 @@ __ https://github.com/matthewwithanm/pilkit/graphs/contributors
 .. _Matthew Tretter: http://github.com/matthewwithanm
 .. _Chris Drackett: http://github.com/chrisdrackett
 .. _Greg Newman: http://github.com/gregnewman
+.. _Venelin Stoykov: http://github.com/vstoykov
 .. _Justin Driscoll: http://github.com/jdriscoll
 .. _Timothée Peignier: http://github.com/cyberdelia
 .. _Jan Sagemüller: https://github.com/version2
diff --git a/MANIFEST.in b/MANIFEST.in
index 67b0259..17a4a05 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -2,4 +2,4 @@ include AUTHORS
 include LICENSE
 include README.rst
 recursive-include docs *
-recursive-include tests *
+recursive-include tests *.py *.gif *.png *.jpg
diff --git a/PKG-INFO b/PKG-INFO
index bbf7157..1636e1c 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: pilkit
-Version: 1.1.13
+Version: 2.0
 Summary: A collection of utilities and processors for the Python Imaging Libary.
 Home-page: http://github.com/matthewwithanm/pilkit/
 Author: Matthew Tretter
@@ -18,6 +18,7 @@ Description: PILKit is a collection of utilities for working with PIL (the Pytho
         `PILKit on RTD`_.
         
         .. image:: https://api.travis-ci.org/matthewwithanm/pilkit.png
+          :target: https://travis-ci.org/matthewwithanm/pilkit
         
         .. _`PILKit on RTD`: http://pilkit.readthedocs.org
         .. _`Instakit`: https://github.com/fish2000/instakit
@@ -113,9 +114,10 @@ Classifier: Development Status :: 5 - Production/Stable
 Classifier: Intended Audience :: Developers
 Classifier: License :: OSI Approved :: BSD License
 Classifier: Operating System :: OS Independent
-Classifier: Programming Language :: Python :: 2.5
-Classifier: Programming Language :: Python :: 2.6
+Classifier: Programming Language :: Python :: 2
 Classifier: Programming Language :: Python :: 2.7
-Classifier: Programming Language :: Python :: 3.2
+Classifier: Programming Language :: Python :: 3
 Classifier: Programming Language :: Python :: 3.3
+Classifier: Programming Language :: Python :: 3.4
+Classifier: Programming Language :: Python :: 3.5
 Classifier: Topic :: Utilities
diff --git a/README.rst b/README.rst
index 705b609..744a9ab 100644
--- a/README.rst
+++ b/README.rst
@@ -10,6 +10,7 @@ Looking for more advanced processors? Check out `Instakit`_!
 `PILKit on RTD`_.
 
 .. image:: https://api.travis-ci.org/matthewwithanm/pilkit.png
+  :target: https://travis-ci.org/matthewwithanm/pilkit
 
 .. _`PILKit on RTD`: http://pilkit.readthedocs.org
 .. _`Instakit`: https://github.com/fish2000/instakit
diff --git a/pilkit.egg-info/PKG-INFO b/pilkit.egg-info/PKG-INFO
index bbf7157..1636e1c 100644
--- a/pilkit.egg-info/PKG-INFO
+++ b/pilkit.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: pilkit
-Version: 1.1.13
+Version: 2.0
 Summary: A collection of utilities and processors for the Python Imaging Libary.
 Home-page: http://github.com/matthewwithanm/pilkit/
 Author: Matthew Tretter
@@ -18,6 +18,7 @@ Description: PILKit is a collection of utilities for working with PIL (the Pytho
         `PILKit on RTD`_.
         
         .. image:: https://api.travis-ci.org/matthewwithanm/pilkit.png
+          :target: https://travis-ci.org/matthewwithanm/pilkit
         
         .. _`PILKit on RTD`: http://pilkit.readthedocs.org
         .. _`Instakit`: https://github.com/fish2000/instakit
@@ -113,9 +114,10 @@ Classifier: Development Status :: 5 - Production/Stable
 Classifier: Intended Audience :: Developers
 Classifier: License :: OSI Approved :: BSD License
 Classifier: Operating System :: OS Independent
-Classifier: Programming Language :: Python :: 2.5
-Classifier: Programming Language :: Python :: 2.6
+Classifier: Programming Language :: Python :: 2
 Classifier: Programming Language :: Python :: 2.7
-Classifier: Programming Language :: Python :: 3.2
+Classifier: Programming Language :: Python :: 3
 Classifier: Programming Language :: Python :: 3.3
+Classifier: Programming Language :: Python :: 3.4
+Classifier: Programming Language :: Python :: 3.5
 Classifier: Topic :: Utilities
diff --git a/pilkit.egg-info/SOURCES.txt b/pilkit.egg-info/SOURCES.txt
index dbde91c..7f8a4c5 100644
--- a/pilkit.egg-info/SOURCES.txt
+++ b/pilkit.egg-info/SOURCES.txt
@@ -20,25 +20,12 @@ pilkit.egg-info/top_level.txt
 pilkit/processors/__init__.py
 pilkit/processors/base.py
 pilkit/processors/crop.py
+pilkit/processors/overlay.py
 pilkit/processors/resize.py
 pilkit/processors/utils.py
 tests/__init__.py
-tests/__init__.pyc
 tests/test_processors.py
-tests/test_processors.pyc
 tests/test_utils.py
-tests/test_utils.pyc
 tests/utils.py
-tests/utils.pyc
-tests/__pycache__/__init__.cpython-32.pyc
-tests/__pycache__/__init__.cpython-33.pyc
-tests/__pycache__/test_processors.cpython-32.pyc
-tests/__pycache__/test_processors.cpython-33.pyc
-tests/__pycache__/test_utils.cpython-32.pyc
-tests/__pycache__/test_utils.cpython-33.pyc
-tests/__pycache__/utils.cpython-32.pyc
-tests/__pycache__/utils.cpython-33.pyc
 tests/assets/cat.gif
-tests/assets/lenna-800x600-white-border.jpg
-tests/assets/lenna-800x600.jpg
-tests/assets/lenna.png
\ No newline at end of file
+tests/assets/reference.png
\ No newline at end of file
diff --git a/pilkit/pkgmeta.py b/pilkit/pkgmeta.py
index f135438..da2338e 100644
--- a/pilkit/pkgmeta.py
+++ b/pilkit/pkgmeta.py
@@ -1,5 +1,5 @@
 __title__ = 'pilkit'
 __author__ = 'Matthew Tretter'
-__version__ = '1.1.13'
+__version__ = '2.0'
 __license__ = 'BSD'
 __all__ = ['__title__', '__author__', '__version__', '__license__']
diff --git a/pilkit/processors/__init__.py b/pilkit/processors/__init__.py
index d5962a8..a7d5156 100644
--- a/pilkit/processors/__init__.py
+++ b/pilkit/processors/__init__.py
@@ -12,4 +12,5 @@ from the filesystem.
 
 from .base import *
 from .crop import *
+from .overlay import *
 from .resize import *
diff --git a/pilkit/processors/overlay.py b/pilkit/processors/overlay.py
new file mode 100644
index 0000000..5ccabd9
--- /dev/null
+++ b/pilkit/processors/overlay.py
@@ -0,0 +1,23 @@
+from pilkit.lib import Image
+
+
+class ColorOverlay(object):
+    """
+    Overlay a color mask with a the given opacity
+    """
+
+    def __init__(self, color, overlay_opacity=0.5):
+        """
+        :pamra color: `ImageColor` instance to overlay on the original image
+        :param overlay_opacity: Define the fusion factor for the overlay mask
+
+        """
+        self.color = color
+        self.overlay_opacity = overlay_opacity
+
+    def process(self, img):
+        original = img = img.convert('RGB')
+        overlay = Image.new('RGB', original.size, self.color)
+        mask = Image.new('RGBA', original.size, (0,0,0,int((1.0 - self.overlay_opacity)*255)))
+        img = Image.composite(original, overlay, mask).convert('RGB')
+        return img
diff --git a/pilkit/utils.py b/pilkit/utils.py
index a70fcae..c5b9459 100644
--- a/pilkit/utils.py
+++ b/pilkit/utils.py
@@ -240,18 +240,25 @@ class quiet(object):
     """
     def __enter__(self):
         try:
+            self.stderr_fd = sys.__stderr__.fileno()            
+        except AttributeError:
+            # In case of Azure, the file descriptor is not present so we can return
+            # from here
+            return
+        try:
             self.null_fd = os.open(os.devnull, os.O_RDWR)
         except OSError:
             # If dev/null isn't writeable, then they just have to put up with
             # the noise.
             return
-        self.stderr_fd = sys.__stderr__.fileno()
         self.old = os.dup(self.stderr_fd)
         os.dup2(self.null_fd, self.stderr_fd)
 
     def __exit__(self, *args, **kwargs):
         if not getattr(self, 'null_fd', None):
             return
+        if not getattr(self, 'old', None):
+            return
         os.dup2(self.old, self.stderr_fd)
         os.close(self.null_fd)
         os.close(self.old)
diff --git a/setup.py b/setup.py
index 5eaa2f7..6f23695 100644
--- a/setup.py
+++ b/setup.py
@@ -32,9 +32,9 @@ setup(
     zip_safe=False,
     include_package_data=True,
     tests_require=[
-        'mock==1.0.1',
-        'nose==1.2.1',
-        'nose-progressive==1.3',
+        'mock>=1.0.1',
+        'nose>=1.3.6',
+        'nose-progressive>=1.5.1',
         'Pillow',
     ],
     test_suite='nose.collector',
@@ -44,11 +44,12 @@ setup(
         'Intended Audience :: Developers',
         'License :: OSI Approved :: BSD License',
         'Operating System :: OS Independent',
-        'Programming Language :: Python :: 2.5',
-        'Programming Language :: Python :: 2.6',
+        'Programming Language :: Python :: 2',
         'Programming Language :: Python :: 2.7',
-        'Programming Language :: Python :: 3.2',
+        'Programming Language :: Python :: 3',
         'Programming Language :: Python :: 3.3',
+        'Programming Language :: Python :: 3.4',
+        'Programming Language :: Python :: 3.5',
         'Topic :: Utilities'
     ],
 )
diff --git a/tests/assets/reference.png b/tests/assets/reference.png
new file mode 100644
index 0000000..385716c
Binary files /dev/null and b/tests/assets/reference.png differ
diff --git a/tests/test_processors.py b/tests/test_processors.py
index f534892..831a2c9 100644
--- a/tests/test_processors.py
+++ b/tests/test_processors.py
@@ -1,6 +1,6 @@
-from pilkit.lib import Image, ImageDraw
+from pilkit.lib import Image, ImageDraw, ImageColor
 from pilkit.processors import (Resize, ResizeToFill, ResizeToFit, SmartCrop,
-                               SmartResize, MakeOpaque)
+                               SmartResize, MakeOpaque, ColorOverlay)
 from nose.tools import eq_, assert_true
 import os
 from pilkit.processors.resize import Thumbnail
@@ -45,6 +45,16 @@ def test_resizetofit_mat():
     eq_(img.size, (100, 100))
 
 
+def test_coloroverlay():
+    """
+    Test that the ColorOverlay processor
+    """
+    img = Image.new('RGB', (200, 100))
+    color = ImageColor.getrgb('#cc0000')
+    img = ColorOverlay(color, overlay_opacity=1.0).process(img)
+    eq_(img.getpixel((0,0)), (204, 0, 0))
+
+
 def test_resize_antialiasing():
     """
     Test that the Resize processor antialiases.
diff --git a/tests/utils.py b/tests/utils.py
index 91f5834..0b0bb85 100644
--- a/tests/utils.py
+++ b/tests/utils.py
@@ -11,7 +11,7 @@ def get_image_file():
 
     """
     dir = os.path.dirname(__file__)
-    path = os.path.join(dir, 'assets', 'lenna.png')
+    path = os.path.join(dir, 'assets', 'reference.png')
     return open(path, 'r+b')
 
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/pilkit.git



More information about the Python-modules-commits mailing list