-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Image CMS modes #8007
Comments
The following code will reach one of those lines. from PIL import ImageCms
source_profile = ImageCms.createProfile("sRGB")
destination_profile = ImageCms.createProfile("sRGB")
ImageCms.buildTransform(source_profile, destination_profile, "RGB", "YCC") But it will raise an error afterwards. I'm guessing you meant reach those lines without error? |
You can't use the |
From a documentation perspective, https://pillow.readthedocs.io/en/stable/reference/ImageCms.html#PIL.ImageCms.buildTransform describes
Those are the modes that are passed to However, from a practical perspective, the following code runs without an error. from PIL import Image, ImageCms
for inMode in ("L;16", "L;16B"):
source_profile = ImageCms.getOpenProfile("/Users/andrewmurray/pillow/Pillow/Tests/icc/sGrey-v2-nano.icc")
destination_profile = ImageCms.createProfile("sRGB")
transform = ImageCms.buildTransform(source_profile, destination_profile, inMode, "RGB")
im = Image.new("RGB", (1, 1))
ImageCms.applyTransform(im, transform)
source_profile = ImageCms.getOpenProfile("/Users/andrewmurray/pillow/Pillow/Tests/icc/sRGB_v4_ICC_preference.icc")
destination_profile = ImageCms.createProfile("sRGB")
transform = ImageCms.buildTransform(source_profile, destination_profile, "RGBA;16B", "RGB")
im = Image.new("RGB", (1, 1))
ImageCms.applyTransform(im, transform) |
Would updating the documentation be sufficient to resolve this? |
I've created #8031 to resolve this by deprecating the unexpected modes, and adding replacements for some. |
When the C code checks the given input and output modes it checks against this list:
RGB
,RGBA
,RGBX
,RGBA;16B
,CMYK
,L
,L;16
,L;16B
,YCCA
,YCC
, andLAB
.Pillow/src/_imagingcms.c
Lines 214 to 244 in e63ae38
However, only
RGB
,RGBA
,RGBX
,CMYK
,L
, andLAB
are actual imaging modes.RGBA;16B
,L;16
, andL;16B
are rawmodes,YCCA
partially exists as a rawmode namedYCCA;P
, andYCC
is a mode but is namedYCbCr
. That last one is easy enough to fix by just using the correct name, but it doesn't seem like it's possible to use the other four.The text was updated successfully, but these errors were encountered: