def __init__(self, img_source):
if isinstance(img_source, Image.Image):<EOL><INDENT>img_original = img_source<EOL><DEDENT>else:<EOL><INDENT>img_original = Image.open(img_source)<EOL><DEDENT>self.img_original = img_original<EOL>img_original = img_original.convert('<STR_LIT>')<EOL>im = Image.new("<STR_LIT>", img_original.size, (<NUM_LIT:255>, <NUM_LIT:255>, <NUM_LIT:255>))<EOL>im.paste(img_original, mask=img_original.split()[<NUM_LIT:3>])<EOL>im = im.convert("<STR_LIT:L>")<EOL>im = ImageOps.invert(im)<EOL>self._im = im.convert("<STR_LIT:1>")<EOL>
Load in an image

:param img_source: PIL.Image, or filename to load one from.