diff --git a/CHANGELOG.md b/CHANGELOG.md index 43102a344..fbb87a48d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## 1.20.6 +### Changes +- Add a guard if PIL doesn't support ImageCms ([#1032](../../pull/1032)) + ### Bug Fixes - Allow clearing the min/max fields of the frame selector ([#1030](../../pull/1030)) - Fix a bug with caching tiles and styling ([#1031](../../pull/1031)) diff --git a/large_image/tilesource/base.py b/large_image/tilesource/base.py index 42aa54a42..f88b91e3f 100644 --- a/large_image/tilesource/base.py +++ b/large_image/tilesource/base.py @@ -1281,7 +1281,16 @@ def _applyICCProfile(self, sc, frame): intent = getattr(PIL.ImageCms, 'INTENT_' + str(sc.style.get('icc')).upper(), PIL.ImageCms.INTENT_PERCEPTUAL) if not hasattr(self, '_iccsrgbprofile'): - self._iccsrgbprofile = PIL.ImageCms.createProfile('sRGB') + try: + self._iccsrgbprofile = PIL.ImageCms.createProfile('sRGB') + except ImportError: + self._iccsrgbprofile = None + self.logger.warning( + 'Failed to import PIL.ImageCms. Cannot perform ICC ' + 'color adjustments. Does your platform support ' + 'PIL.ImageCms?') + if self._iccsrgbprofile is None: + return sc.image try: key = (mode, intent) if self._iccprofilesObjects[profileIdx] is None: