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

srgbify can't convert this image, for some reason #24

Open
alexwlchan opened this issue May 8, 2024 · 1 comment
Open

srgbify can't convert this image, for some reason #24

alexwlchan opened this issue May 8, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@alexwlchan
Copy link
Owner

When I try to convert the image in the attached ZIP, I get an error "cannot build transform". It would be good to understand what's going on and fix it.

practical-svg.png.zip

@alexwlchan alexwlchan added the bug Something isn't working label May 8, 2024
@alexwlchan
Copy link
Owner Author

Here's the traceback:

Traceback (most recent call last):
  File "/private/var/folders/lp/1yl_g9ls2_g3l2tkmb6fpg0h0000gn/T/tmp.QxFezTSFZ4/.venv/lib/python3.12/site-packages/PIL/ImageCms.py", line 463, in profileToProfile
    transform = ImageCmsTransform(
                ^^^^^^^^^^^^^^^^^^
  File "/private/var/folders/lp/1yl_g9ls2_g3l2tkmb6fpg0h0000gn/T/tmp.QxFezTSFZ4/.venv/lib/python3.12/site-packages/PIL/ImageCms.py", line 306, in __init__
    self.transform = core.buildTransform(
                     ^^^^^^^^^^^^^^^^^^^^
ValueError: cannot build transform

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Users/alexwlchan/repos/scripts/images/srgbify.py", line 88, in <module>
    out_im = convert_image_to_srgb(im)
             ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/alexwlchan/repos/scripts/images/srgbify.py", line 58, in convert_image_to_srgb
    return ImageCms.profileToProfile(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/private/var/folders/lp/1yl_g9ls2_g3l2tkmb6fpg0h0000gn/T/tmp.QxFezTSFZ4/.venv/lib/python3.12/site-packages/PIL/ImageCms.py", line 478, in profileToProfile
    raise PyCMSError(v) from v
PIL.ImageCms.PyCMSError: cannot build transform

That core.buildTransform() function called from ImageCms.py seems to be defined somewhere in a C library, so I can't debug it further.

I'm not going to investigate this further unless I see more images with this issue – Acorn was able to handle it fine for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant