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

Increase PIL.Image.MAX_IMAGE_PIXELS #735

Closed
kba opened this issue Nov 4, 2021 · 3 comments
Closed

Increase PIL.Image.MAX_IMAGE_PIXELS #735

kba opened this issue Nov 4, 2021 · 3 comments
Assignees

Comments

@kba
Copy link
Member

kba commented Nov 4, 2021

By default, PIL has a maximum number of pixels of 89478485, i.e. a square image of 9500 pixels. Large high-resolution newspaper scans can be larger than that. @mittagessen increased this to accomodate up to 20,000 by 20,000 pixels in kraken, which seems reasonable and we should probably do the same.

@stweil
Copy link
Contributor

stweil commented Dec 8, 2021

Tesseract has an open issue because it is limited to 32767 x 32767 pixels. So maybe the proposed new limit here is still too small.

@kba
Copy link
Member Author

kba commented Dec 8, 2021

Tesseract has an open issue because it is limited to 32767 x 32767 pixels. So maybe the proposed new limit here is still too small.

Fine by me, but we need to keep this in mind when transitioning to HTTP interfaces, lest malicious API clients use this for DOS attacks.

@stweil
Copy link
Contributor

stweil commented Dec 8, 2021

That's right. As large images are usually rectangles (not squares) and the crucial point in DOS attacks is the memory usage, limiting the total number of pixels to something lower than the x, y limits might also be acceptable.

Perhaps it is also necessary to have limits which can be configured to match the available computing resources.

I already experience such (unexpected) limits with Calamari and Kraken training (more than 64 GiB RAM for commonly used training data sets) and Dinglehopper (30 GiB RAM with two text files of about 3000 lines each).

@kba kba closed this as completed in 4b7bf23 Feb 1, 2022
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

No branches or pull requests

2 participants