Skip to content

ImageDraw.Draw.rectangle is ignoring fill alpha #2496

@crobertsbmw

Description

@crobertsbmw

What did you do?

from PIL import Image
from PIL import ImageDraw 
from io import BytesIO
from urllib.request import urlopen

url = "https://i.ytimg.com/vi/W4qijIdAPZA/maxresdefault.jpg"
file = BytesIO(urlopen(url).read())
img = Image.open(file)
img = img.convert("RGBA")
draw = ImageDraw.Draw(img, "RGBA")
draw.rectangle(((0, 00), (img.size[0], img.size[1])), fill=(0,0,0,127))
img.save('dark-cat.jpg')

What did you expect to happen?

I expected to see this:
image

What actually happened?

I got a black square:
dark-cat

What versions of Pillow and Python are you using?

Python 3.5.2
Pillow==4.1.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions