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

convert("LAB") fails for RGB #6643

Closed
tkzv opened this issue Oct 6, 2022 · 1 comment · Fixed by #6647
Closed

convert("LAB") fails for RGB #6643

tkzv opened this issue Oct 6, 2022 · 1 comment · Fixed by #6647

Comments

@tkzv
Copy link

tkzv commented Oct 6, 2022

What did you do?

Called PIL.Image.Image.convert(mode='LAB') for an RGB image

img = PIL.Image.open('filename.png').convert(mode='LAB')

What did you expect to happen?

Conversion of data to LAB colourspace.

What actually happened?

ValueError: conversion from RGB to LAB not supported

The following code did work:

rgb_lab_transform = PIL.ImageCms.buildTransformFromOpenProfiles(PIL.ImageCms.createProfile('sRGB'), PIL.ImageCms.createProfile('LAB'), 'RGB', 'LAB')
img = PIL.ImageCms.applyTransform(Image.open('filename.png').convert(mode='RGB'), rgb_lab_transform)

What are your OS, Python and Pillow versions?

  • OS: Linux, kernel 5.15.32-gentoo-r1
  • Python: 3.10.6
  • Pillow: 9.2.0
@radarhere
Copy link
Member

I've created PR #6647 to resolve this.

@radarhere radarhere changed the title convert(mode='LAB') fails for RGB convert("LAB") fails for RGB Oct 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants