You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi. If an image is in mode L, then it doesn't have red, green and blue colors. Instead, it has just a single grayscale color. So instead of trying to draw (255, 255, 0) on your L image, you could either
use a grayscale color - draw.rectangle((0,20,0,30), fill=None, outline=255)
if you want to draw yellow, convert the image to RGB first and then try again - grayimage = grayimage.convert("RGB")
#5504 will be a part of the next Pillow release, changing the error message from "TypeError: function takes exactly 1 argument (3 given)" to a clearer "color must be int or single-element tuple".
What did you do?
I would like to draw a rectangle on a grayscale image. thanks for your help
What did you expect to happen?
Drawing a rectangle on a RGB image works as expected but it fails when using a grayscale image
What actually happened?
I get the following error message:
PIL (255, 255, 0) <class 'tuple'> L <class 'str'>
What are your OS, Python and Pillow versions?
The text was updated successfully, but these errors were encountered: