Skip to content

Commit

Permalink
synctiles: use default rendering intent from slide ICC profile
Browse files Browse the repository at this point in the history
ICC profiles don't necessarily support all rendering intents, and aren't
necessarily optimized for all the intents they do support.  They can also
be queried for the rendering intent recommended by the profile creator.
Use that instead of absolute colorimetric.

xref openslide/openslide-python#227

Signed-off-by: Benjamin Gilbert <[email protected]>
  • Loading branch information
bgilbert committed Oct 8, 2023
1 parent 52a83d7 commit 44438d5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions demo/_synctiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@
TILE_SIZE = 510
OVERLAP = 1
LIMIT_BOUNDS = True
RENDERING_INTENT = ImageCms.Intent.ABSOLUTE_COLORIMETRIC
GROUP_NAME_MAP = {
'Generic-TIFF': 'Generic TIFF',
'Hamamatsu': 'Hamamatsu NDPI',
Expand Down Expand Up @@ -103,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 44438d5

Please sign in to comment.