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

Cannot save TIFF files with clipping info #7008

Closed
dorphalsig opened this issue Mar 12, 2023 · 8 comments
Closed

Cannot save TIFF files with clipping info #7008

dorphalsig opened this issue Mar 12, 2023 · 8 comments

Comments

@dorphalsig
Copy link

dorphalsig commented Mar 12, 2023

I am opening a TIFF file with clipping path data (see #6025), I now want to save it with another name (nothing else was done to it)

from PIL import Image
img = Image.open('images/path test.tif')
ex = ""
try:
    img.save("path test public.tif")
except Exception as e:
    ex=e

error message is "path test public.tif: Failed to allocate memory for custom tag binary object (-1578999712 elements of 1 bytes each)."

when I print the exception I see: RuntimeError('Error setting from dictionary')
file is attached inside a zip
Path test.zip

@radarhere radarhere changed the title Cannot Save TIFF files with clipping info Cannot save TIFF files with clipping info Mar 12, 2023
@dorphalsig
Copy link
Author

update tried it with another file that also has clipping info and got the same prob. updated tip file is attached
Path test.zip

@radarhere radarhere added the TIFF label Mar 12, 2023
@radarhere
Copy link
Member

Are you on a 32-bit machine, or 64-bit?

@dorphalsig
Copy link
Author

dorphalsig commented Mar 13, 2023 via email

@radarhere
Copy link
Member

Hmm. That doesn't quite match what I'm seeing, so let me ask - what happens if you delete the EXIF key from the TIFF tags? Does the script run successfully then?

from PIL import Image
img = Image.open('images/path test.tif')
del img.tag_v2[34665]
ex = ""
try:
    img.save("path test public.tif")
except Exception as e:
    ex=e

@dorphalsig
Copy link
Author

Hi. Nope. exact same error

@radarhere
Copy link
Member

Ok, thanks. I've put together a potential fix, that should be part of Pillow 9.5.0 when it is released on April 1.

I'll check back in around then to confirm that it does indeed also resolve the problem in your environment.

@radarhere
Copy link
Member

radarhere commented Apr 1, 2023

PR #7053 has been merged and released. Is your problem fixed with Pillow 9.5.0?

@github-actions
Copy link

github-actions bot commented Apr 9, 2023

Closing this issue as no feedback has been received.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Apr 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants