diff --git a/dev-req.txt b/dev-req.txt
index 153791a..4e1c3aa 100644
--- a/dev-req.txt
+++ b/dev-req.txt
@@ -3,4 +3,4 @@ pyquery
docutils
mock
nose
-PIL
+pillow
diff --git a/hyde/ext/plugins/images.py b/hyde/ext/plugins/images.py
index 0ff4538..85b8b6c 100644
--- a/hyde/ext/plugins/images.py
+++ b/hyde/ext/plugins/images.py
@@ -2,17 +2,21 @@
"""
Contains classes to handle images related things
-# Requires PIL
+# Requires PIL or pillow
"""
from hyde.plugin import Plugin
-from hyde.fs import File, Folder
import re
-import Image
import glob
import os
+try:
+ from PIL import Image
+except ImportError:
+ # No pillow
+ import Image
+
class ImageSizerPlugin(Plugin):
"""
Each HTML page is modified to add width and height for images if
@@ -239,7 +243,7 @@ class ImageThumbnailsPlugin(Plugin):
path = os.path.join(".thumbnails",
os.path.dirname(resource.get_relative_deploy_path()),
"%s%s" % (prefix, name))
- target = File(Folder(resource.site.config.content_root_path).child(path))
+ target = resource.site.config.content_root_path.child_file(path)
res = self.site.content.add_resource(target)
res.set_relative_deploy_path(res.get_relative_deploy_path().replace('.thumbnails/', '', 1))
diff --git a/hyde/tests/ext/test_images.py b/hyde/tests/ext/test_images.py
index fe9628d..0da0b00 100644
--- a/hyde/tests/ext/test_images.py
+++ b/hyde/tests/ext/test_images.py
@@ -26,7 +26,11 @@ IMAGES = [PORTRAIT_IMAGE, LANDSCAPE_IMAGE]
SIZES = [PORTRAIT_SIZE, LANDSCAPE_SIZE]
# PIL requirement
-import Image
+try:
+ from PIL import Image
+except ImportError:
+ # No pillow
+ import Image
class TestImageSizer(object):
@@ -91,12 +95,11 @@ class TestImageSizer(object):
text = u"""
"""
- html = self._generic_test_image(text)
+ self._generic_test_image(text)
def test_size_image_multiline(self):
text = u"""
-
+
""" % PORTRAIT_IMAGE
html = self._generic_test_image(text)
assert ' width="%d"' % PORTRAIT_SIZE[0] in html