-
Notifications
You must be signed in to change notification settings - Fork 50
Closed
Description
Problem
Currently pyvips only supports reading ICC profiles from a file as far as I can see. OpenSlide gives an io.BytesIO output.
I have modified openslide-python to output pyvips.Image
.
Code example
So right now you can do this:
import openslide.lowlevel as openslide_lowlevel
import os
owsi = openslide_lowlevel.open(str(filename))
profile = openslide_lowlevel.read_icc_profile(owsi)
color_profile = io.BytesIO(profile)
With PIL
you can now do this:
pil_region = wsi.read_region(coordinates, level, size)
to_profile = PIL.ImageCms.createProfile("sRGB")
intent = PIL.ImageCms.getDefaultIntent(color_profile)
color_transform = PIL.ImageCms.buildTransform(color_profile, to_profile, "RGBA", "RGBA", intent, 0)
PIL.ImageCms.applyTransform(pil_region, color_transform, inPlace=True)
This does not seem to be possible with pyvips and I need to dump color_profile to disk?
Metadata
Metadata
Assignees
Labels
No labels