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

MemoryError: Integer overflow in ysize #3963

Closed
elhuhdron opened this issue Jul 11, 2019 · 9 comments · Fixed by #3964
Closed

MemoryError: Integer overflow in ysize #3963

elhuhdron opened this issue Jul 11, 2019 · 9 comments · Fixed by #3964

Comments

@elhuhdron
Copy link

elhuhdron commented Jul 11, 2019

Many PIL operations are working for me for image manipulations of images over 32 bit in size, which is fantastic. However, I still have a problem with fromarray, tested using PIL version 6.1.0 and numpy version 1.16.4. I believe this version already incorporates fix #3791 (?)

The test case is relatively simple:

from PIL import Image
import numpy as np

# this works
a = np.zeros((46340, 46340), dtype=np.uint8)
b = Image.fromarray(a)
del a,b

# this works
b = Image.new('L', (46341, 46341))
del b

# this does not work, fails with:
# MemoryError: Integer overflow in ysize
a = np.zeros((46341, 46341), dtype=np.uint8)
b = Image.fromarray(a)

This is likely because 46341*46341 > 2^31-1
Is this easily fixable?

@radarhere
Copy link
Member

#3791 was included as part of Pillow 6.1.0, yes.

I've created PR #3964 to resolve this.

@hugovk
Copy link
Member

hugovk commented Jul 17, 2019

@elhuhdron Please could you test PR #3964?

@elhuhdron
Copy link
Author

@elhuhdron Please could you test PR #3964?

Yes, verified. I built and installed the PR branch and the overflow error is no longer thrown. Thanks!

@hugovk
Copy link
Member

hugovk commented Jul 17, 2019

Thanks both, merged!

@00krishna
Copy link

I am still running into this problem now. I tried to download through pip and reinstall. I also cloned the repo and installed from source, but still running into the same error message when using fromarray. My image is (156093, 91380).

@hugovk
Copy link
Member

hugovk commented Jul 18, 2019

@00krishna It's not been released yet, it'll be in the next release due on 1st October. In the meantime you can build from source using the latest master:

@00krishna
Copy link

@hugovk Oh thanks for the tip. Okay I looked at the link you included and it said to download the latest source from PYPI. On PYPI it indicates that the latest version is 6.1 uploaded on July 2, 2019. But I suppose I need the latest version of the software that includes the fix for this particular issue. Is there some way to fix the Integer overflow in ysize error when I build from source? Thanks for your help.

@radarhere
Copy link
Member

@00krishna
Copy link

00krishna commented Jul 18, 2019

Thanks @radarhere . I appreciate your posting the link to the dev branch. I tried it out and it seem to work now. Thanks again all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants