We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
The following works smoothly:
>>> PIL.Image.new('L', (200,100), (255,)) # accepts tuple
However, for 32-bit modes, this does not work:
>>> PIL.Image.new('F', (200,100), (255,)) # fails okay Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/lib/python3.6/site-packages/PIL/Image.py", line 2613, in new return im._new(core.fill(mode, size, color)) TypeError: must be real number, not tuple >>> PIL.Image.new('I', (200,100), (255,)) # fails badly Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/lib/python3.6/site-packages/PIL/Image.py", line 2613, in new return im._new(core.fill(mode, size, color)) SystemError: <built-in function fill> returned NULL without setting an error
At least the error message in the latter case should be improved.
But why not be more tolerant in both cases (I or F), like above (L or P)?
(Seen with Pillow 7.2.0 on Python 3.6.7 Linux x86_64.)
The text was updated successfully, but these errors were encountered:
Note: always allowing tuple would make it easier to pass values from ImageStat.Stat().median etc. (without checking for bands and unlisting)
ImageStat.Stat().median
Sorry, something went wrong.
With #4882 in master the last one has a proper error message:
>>> PIL.Image.new('I', (200,100), (255,)) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "c:\git\pillow\src\PIL\Image.py", line 2621, in new return im._new(core.fill(mode, size, color)) TypeError: color must be int
I've created PR #4927 as a suggestion to resolve this.
Successfully merging a pull request may close this issue.
The following works smoothly:
However, for 32-bit modes, this does not work:
At least the error message in the latter case should be improved.
But why not be more tolerant in both cases (I or F), like above (L or P)?
(Seen with Pillow 7.2.0 on Python 3.6.7 Linux x86_64.)
The text was updated successfully, but these errors were encountered: