Skip to content
Snippets Groups Projects
Commit af979830 authored by Paul McCarthy's avatar Paul McCarthy :mountain_bicyclist:
Browse files

RF: Make Pillow conditional

parent 740e6774
No related branches found
No related tags found
No related merge requests found
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
# Author: Paul McCarthy <pauldmccarthy@gmail.com> # Author: Paul McCarthy <pauldmccarthy@gmail.com>
# #
"""This module contains the :class:`Bitmap` class, for loading bitmap image """This module contains the :class:`Bitmap` class, for loading bitmap image
files. files. Pillow is required to use the ``Bitmap`` class.
""" """
...@@ -14,7 +14,6 @@ import logging ...@@ -14,7 +14,6 @@ import logging
import six import six
import numpy as np import numpy as np
import PIL.Image as Image
from . import image as fslimage from . import image as fslimage
...@@ -52,6 +51,11 @@ class Bitmap(object): ...@@ -52,6 +51,11 @@ class Bitmap(object):
data. data.
""" """
try:
import PIL.Image as Image
except ImportError:
raise RuntimeError('Install Pillow to use the Bitmap class')
if isinstance(bmp, six.string_types): if isinstance(bmp, six.string_types):
source = bmp source = bmp
data = np.array(Image.open(source)) data = np.array(Image.open(source))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment