scroll- irc bot to play ascii art |
git clone git://git.acid.vegas/scroll.git |
Log | Files | Refs | Archive | README | LICENSE |
commit 22c2d78980abea8232f172477a105c4b25869879
parent b0e8a15f0ee5c7a18296b183a63b87fd5f62695a Author: acidvegas <acid.vegas@acid.vegas> Date: Wed, 28 Jun 2023 15:12:45 -0400 Added greyscale/blackwhite effects to img2irc (not implemented into scroll yet) Diffstat:
|
1 file changed, 5 insertions(+), 1 deletion(-) |
diff --git a/img2irc.py b/img2irc.py @@ -45,13 +45,17 @@ palettes = { 0xbcbcbc, 0xe2e2e2, 0xffffff] } -def convert(data, max_line_len, img_width=80, palette='RGB99', enhance=False): +def convert(data, max_line_len, img_width=80, palette='RGB99', enhance=False, effect=None): if palette not in palettes: raise Exception('invalid palette option') palette = palettes[palette] image = Image.open(io.BytesIO(data)) if enhance: image = ImageEnhance.Contrast(image) + if effect == 'grey': + image = image.convert("L") + elif effect == 'black': + image = image.convert("1") del data return convert_image(image, max_line_len, img_width, palette) |