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

ValueError: tile cannot extend outside image on fromarray() #3902

Closed
NicoLivesey opened this issue Jun 13, 2019 · 9 comments
Closed

ValueError: tile cannot extend outside image on fromarray() #3902

NicoLivesey opened this issue Jun 13, 2019 · 9 comments
Projects

Comments

@NicoLivesey
Copy link

NicoLivesey commented Jun 13, 2019

What did you do?

Trying to convert an array into Image after crop

What did you expect to happen?

Works

What actually happened?

ValueError: tile cannot extend outside image

What are your OS, Python and Pillow versions?

  • OS: Ubuntu 18
  • Python: 3.6...
  • Pillow: 5.1.0

I basically run a script over more than 50k images and this part fails randomly. I have seen related issues such as #3044 and other ones on Stackoverflow but this never happens on an already cropped image.

Thank you in advance !

crop = image[a:b, c:d]
crop_pil = Image.fromarray(crop)
@hugovk
Copy link
Member

hugovk commented Jun 13, 2019

Please can include the image that causes the problem?

Please can also include a self-contained, copy-pastable code sample? Be concise with code posted. Guidelines on how to provide a good bug report:

Bug reports which follow these guidelines are easier to diagnose, and are often handled much more quickly. Thank you!

@NicoLivesey
Copy link
Author

NicoLivesey commented Jun 13, 2019

I am really sorry but I cannot provide neither the image nor the full code and the code sample is the only interesting part of the process. Before that I get coordinates from an object detection model.
In the code example, the crop that causes the problem is:

crop = image[484:852, 22:598]
crop_pil = Image.fromarray(crop)

Once again, I am really sorry that I cannot fit your bug report policy but I just wanted to know if anyone already met an issue like this. I am really thankful for your help.

@radarhere
Copy link
Member

I imagine you'll say that it is not the same, but there is #2383 (comment), which is fixed in the unreleased master branch.

Depending on your architecture, there is #3841.

Could you try using the master branch version of Pillow, rather than Pillow 5.1.0?

@radarhere radarhere changed the title ValueError: tile cannot extend outside image on fromarray() function ValueError: tile cannot extend outside image on fromarray() Jun 22, 2019
@radarhere
Copy link
Member

In case it helps, Pillow 6.1.0 has now been released, which fixes both the issues that I mentioned.

@NicoLivesey
Copy link
Author

Thank you very much !

@aclark4life aclark4life added this to New Issues in Pillow Sep 12, 2019
@mk-45

This comment has been minimized.

@vnyk
Copy link

vnyk commented Apr 3, 2020

I have pillow 6.10 installed and still getting this error.
Did anyone found any alternative solution

@radarhere
Copy link
Member

@vnyk could you create a new issue describing your problem, with a self-contained example including a source image?

@vnyk
Copy link

vnyk commented Apr 3, 2020

@radarhere I did it here #4517

@radarhere radarhere moved this from New Issues to Review/QA in Pillow Apr 24, 2021
@radarhere radarhere moved this from Review/QA to Closed in Pillow Apr 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Pillow
  
Closed
Development

No branches or pull requests

5 participants