I read the documentation on PIL.ImageDraw.Draw.rectangle, which states: The second point is just outside the drawn rectangle. (source: https://pillow.readthedocs.io/en/3.0.x/reference/ImageDraw.html )
Then, I tried out drawing a rectangle of size (0, 0, 200, 20)
A rectangle that starts at pixel 0 and ends before pixel 200, that is 0-199, with 200 pixels width, with 20 pixels height
A 201x21 px rectangle, as if the ending point was just inside the rectangle (instead of outside as the docs say)
PIL.PILLOW_VERSION)# (don't have a minimal example right now)
I will note that there is no Pillow 5.4.7.
Here is code to demonstrate your situation -
from PIL import Image, ImageDraw
im = Image.new("RGB", (300, 300), "#fff")
d = ImageDraw.Draw(im)
d.rectangle((0, 0, 200, 20), "#000")
im.save("out.png")
@radarhere that's what PIL.PILLOW_VERSION was set to for some reason :woman_shrugging: I don't know
And even better example - there is no need to count pixels, just note that black line appeared + show function.
from PIL import Image, ImageDraw
im = Image.new("RGB", (300, 30), "#fff")
d = ImageDraw.Draw(im)
d.rectangle((10, 10, 290, 10), "#000")
im.save("out.png")
im.show()

Feel free to comment if you think otherwise, but I'm closing this is as a duplicate of #1668.
Most helpful comment
I will note that there is no Pillow 5.4.7.
Here is code to demonstrate your situation -