refactored function args. again.

This commit is contained in:
iou1name 2017-12-08 11:34:54 -05:00
parent a83a6c5681
commit 2f9e71560f

View File

@ -183,7 +183,7 @@ def alpha_composite_with_color(image, color=(255, 255, 255)):
return alpha_composite(image, back) return alpha_composite(image, back)
def image_to_ascii(image=None, **kwargs): def image_to_ascii(image=None, reverse=False, brail=False, color=None,**kwargs):
""" """
Reads an image file and converts it to ascii art. Returns a Reads an image file and converts it to ascii art. Returns a
newline-delineated string. If reverse is True, the ascii scale is newline-delineated string. If reverse is True, the ascii scale is
@ -199,14 +199,14 @@ def image_to_ascii(image=None, **kwargs):
image = scale_image(image) image = scale_image(image)
if kwargs["brail"]: if brail:
scale = "brail" scale = "brail"
else: else:
scale = "ascii" scale = "ascii"
if kwargs["reverse"]: if reverse:
scale += "_reverse" scale += "_reverse"
chars = pixels_to_chars(image, scale, kwargs["color"]) chars = pixels_to_chars(image, scale, color)
image.close() image.close()
del(image) del(image)
@ -228,11 +228,11 @@ def ascii_to_image(image_ascii):
return image return image
def handle_gif(**kwargs): def handle_gif(imagePath, **kwargs):
""" """
Handle gifs seperately. Handle gifs seperately.
""" """
image = open_image(kwargs["imagePath"]) image = open_image(imagePath)
ascii_seq = [] ascii_seq = []
new_image = ascii_to_image(image_to_ascii(image, **kwargs)) new_image = ascii_to_image(image_to_ascii(image, **kwargs))
image.seek(1) image.seek(1)