Skip to content

Instantly share code, notes, and snippets.

@sleepless-se
Created February 27, 2019 05:43
Show Gist options
  • Save sleepless-se/2a34fbc72de0532c7d639bbb1b23b186 to your computer and use it in GitHub Desktop.
Save sleepless-se/2a34fbc72de0532c7d639bbb1b23b186 to your computer and use it in GitHub Desktop.
make_maks by PIL
def make_mask(size,start_width,start_height,end_width,end_height):
mask = Image.new("L",(size,size),0)
draw = ImageDraw.Draw(mask)
draw.rectangle((start_width,start_height,end_width,end_height), fill=255)
print('mask',mask.size)
return mask
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment