-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Closed
Labels
BugAny unexpected behavior, until confirmed feature.Any unexpected behavior, until confirmed feature.
Description
What did you do?
Draw a rectangle of size 6*6 in a image with dtype np.uint16, per following code:
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)What did you expect to happen?
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.
What actually happened?
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.
What are your OS, Python and Pillow versions?
- OS: Windows 10
- Python: Anaconda 3.6.8
- Pillow: 5.4.1
Metadata
Metadata
Assignees
Labels
BugAny unexpected behavior, until confirmed feature.Any unexpected behavior, until confirmed feature.