Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a guard if PIL doesn't support ImageCms. #1132

Merged
merged 1 commit into from
Apr 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
11 changes: 10 additions & 1 deletion large_image/tilesource/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down