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
Draw a rectangle of size 6*6 in a image with dtype np.uint16, per following code:
np.uint16
from PIL import ImageDraw, Image import matplotlib.pyplot as plt import numpy as np I = Image.fromarray(np.zeros((8,8), dtype=np.uint16)) d = ImageDraw.Draw(I) d.rectangle([0,0,5,5], fill='white') np.asarray(I)
An output similar to the case of a float image or a uint8 image, (taking into account #367 and #1668), with a square white triangle.
float
uint8
The output is as follows:
array([[65535, 65535, 65535, 0, 0, 0, 0, 0], [65535, 65535, 65535, 0, 0, 0, 0, 0], [65535, 65535, 65535, 0, 0, 0, 0, 0], [65535, 65535, 65535, 0, 0, 0, 0, 0], [65535, 65535, 65535, 0, 0, 0, 0, 0], [65535, 65535, 65535, 0, 0, 0, 0, 0], [ 0, 0, 0, 0, 0, 0, 0, 0], [ 0, 0, 0, 0, 0, 0, 0, 0]], dtype=uint16)
So the rectangle is only half the width compared to the expected size. This only happens for uint16 images as far as I checked.
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
What did you do?
Draw a rectangle of size 6*6 in a image with dtype
np.uint16
, per following code:What did you expect to happen?
An output similar to the case of a
float
image or auint8
image, (taking into account #367 and #1668), with a square white triangle.What actually happened?
The output is as follows:
So the rectangle is only half the width compared to the expected size. This only happens for uint16 images as far as I checked.
What are your OS, Python and Pillow versions?
The text was updated successfully, but these errors were encountered: