changeset 6:0cd9a1362310

fix bug where PIL lives in different places
author Jeff Hammel <jhammel@mozilla.com>
date Mon, 13 Dec 2010 20:08:15 -0800
parents c89738f3f417
children 230fb4ae30c7
files cropresize/__init__.py setup.py
diffstat 2 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/cropresize/__init__.py
+++ b/cropresize/__init__.py
@@ -1,12 +1,15 @@
 #!/usr/bin/env python
 
 import sys
-from PIL import Image
+try:
+    import Image
+except ImportError:
+    from PIL import Image
 
 def crop_resize(image, size, exact_size=False):
     """
     Crop out the proportional middle of the image and set to the desired size.
     * image: a PIL image object
     * size: a 2-tuple of (width,height);  at least one must be specified
     * exact_size: whether to scale up for smaller images
     If the image is bigger than the sizes passed, this works as expected.
--- a/setup.py
+++ b/setup.py
@@ -2,17 +2,17 @@ from setuptools import setup, find_packa
 import sys, os
 
 try:
     filename = os.path.join(os.path.dirname(__file__), 'README.txt')
     description = file(filename).read()
 except:
     description = ''
 
-version = '0.1.4'
+version = '0.1.5'
 
 setup(name='cropresize',
       version=version,
       description="crop and resize an image without doing the math yourself",
       long_description=description,
       classifiers=[], # Get strings from http://pypi.python.org/pypi?%3Aaction=list_classifiers
       keywords='image',
       author='Jeff Hammel',