Skip to content

Commit

Permalink
Merge pull request #57 from bgilbert/synctiles
Browse files Browse the repository at this point in the history
synctiles: use default rendering intent from slide ICC profile
  • Loading branch information
bgilbert authored Oct 8, 2023
2 parents f19217b + 44438d5 commit 4c996c7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions demo/_synctiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@
TILE_SIZE = 510
OVERLAP = 1
LIMIT_BOUNDS = True
RENDERING_INTENT = ImageCms.Intent.ABSOLUTE_COLORIMETRIC
GROUP_NAME_MAP = {
'Generic-TIFF': 'Generic TIFF',
'Hamamatsu': 'Hamamatsu NDPI',
'Hamamatsu-vms': 'Hamamatsu VMS',
'Mirax': 'MIRAX',
'Philips-TIFF': 'Philips TIFF',
}
BUCKET_STATIC = {
'robots.txt': {
Expand Down Expand Up @@ -102,8 +102,9 @@ def get_transform(image):
"""Return a function that transforms an image to sRGB in place."""
if image.color_profile is None:
return lambda img: None
intent = ImageCms.getDefaultIntent(image.color_profile)
transform = ImageCms.buildTransform(
image.color_profile, SRGB_PROFILE, 'RGB', 'RGB', RENDERING_INTENT, 0
image.color_profile, SRGB_PROFILE, 'RGB', 'RGB', intent, 0
)
def xfrm(img):
ImageCms.applyTransform(img, transform, True)
Expand Down

0 comments on commit 4c996c7

Please sign in to comment.