mirror of
git://git.acid.vegas/scroll.git
synced 2024-11-07 08:46:45 +00:00
Added blur and smooth effects
This commit is contained in:
parent
03cd2c405b
commit
89dd0942fb
26
README.md
26
README.md
@ -31,19 +31,19 @@ Designed to be portable, there is no API key needed, no local art files needed,
|
||||
**NOTE**: The sync & settings commands are admin only! `admin` is a *nick!user@host* mask defined in [scroll.py](https://github.com/ircart/scroll/blob/master/scroll.py)
|
||||
|
||||
## Settings
|
||||
| Setting | Type | Default | Description |
|
||||
| ---------------- | ------------ | ------------------------------------------------------------------------------ |
|
||||
| `flood` | int or float | delay between each command |
|
||||
| `ignore` | str | directories to ignore in `.ascii random` *(comma seperated list, no spaces)* |
|
||||
| `lines` | int | max lines outside of #scroll |
|
||||
| `msg` | int or float | delay between each message sent |
|
||||
| `paste` | boolean | enable or disable `.ascii play` |
|
||||
| `png_brightness` | int or float | increase or decrease brightness for `.ascii img` output |
|
||||
| `png_contrast` | int or float | increase or decrease contrast for `.ascii img` output |
|
||||
| `png_effect` | str | change the effect for `.ascii img` output *(greyscale, blackwhite, or invert)* |
|
||||
| `png_palette` | str | palette option for `.ascii img` output *(RGB99 or RGB88)* |
|
||||
| `png_width` | int | maximum width for `.ascii img` output |
|
||||
| `results` | int | max results to return in `.ascii search` |
|
||||
| Setting | Type | Description |
|
||||
| ---------------- | ------------ | -------------------------------------------------------------------------------------------- |
|
||||
| `flood` | int or float | delay between each command |
|
||||
| `ignore` | str | directories to ignore in `.ascii random` *(comma seperated list, no spaces)* |
|
||||
| `lines` | int | max lines outside of #scroll |
|
||||
| `msg` | int or float | delay between each message sent |
|
||||
| `paste` | boolean | enable or disable `.ascii play` |
|
||||
| `png_brightness` | int or float | increase or decrease brightness for `.ascii img` output |
|
||||
| `png_contrast` | int or float | increase or decrease contrast for `.ascii img` output |
|
||||
| `png_effect` | str | change the effect for `.ascii img` output *(blackwhite, blue, greyscale, invert, or smooth)* |
|
||||
| `png_palette` | str | palette option for `.ascii img` output *(RGB99 or RGB88)* |
|
||||
| `png_width` | int | maximum width for `.ascii img` output |
|
||||
| `results` | int | max results to return in `.ascii search` |
|
||||
|
||||
**NOTE**: Setting **0** to `png_brightness`, `png_contrast`, or `png_effect` will disable the setting.
|
||||
|
||||
|
14
img2irc.py
14
img2irc.py
@ -14,11 +14,11 @@ pull request: https://github.com/ircart/scroll/pull/3
|
||||
import io
|
||||
|
||||
try:
|
||||
from PIL import Image, ImageEnhance, ImageOps
|
||||
from PIL import Image, ImageEnhance, ImageFilter, ImageOps
|
||||
except ImportError:
|
||||
raise SystemExit('missing required \'pillow\' library (https://pypi.org/project/pillow/)')
|
||||
|
||||
effects = ('greyscale', 'blackwhite', 'invert')
|
||||
effects = ('blackwhite', 'blur', 'greyscale', 'invert', 'smooth')
|
||||
palettes = {
|
||||
'RGB88': [0xffffff, 0x000000, 0x00007f, 0x009300, 0xff0000, 0x7f0000, 0x9c009c, 0xfc7f00,
|
||||
0xffff00, 0x00fc00, 0x009393, 0x00ffff, 0x0000fc, 0xff00ff, 0x0, 0x0,
|
||||
@ -59,12 +59,16 @@ def convert(data, max_line_len, img_width=80, palette='RGB99', brightness=False,
|
||||
image = ImageEnhance.Brightness(im).enhance(brightness)
|
||||
if contrast:
|
||||
image = ImageEnhance.Contrast(image).enhance(contrast)
|
||||
if effect == 'greyscale':
|
||||
image = image.convert("L")
|
||||
elif effect == 'blackwhite':
|
||||
if effect == 'blackwhite':
|
||||
image = image.convert("1")
|
||||
elif effect == 'blur':
|
||||
image - image.filter(ImageFilter.BLUR)
|
||||
elif effect == 'greyscale':
|
||||
image = image.convert("L")
|
||||
elif effect == 'invert':
|
||||
image = ImageOps.invert(image)
|
||||
elif effect == 'smooth':
|
||||
image = image.filter(ImageFilter.SMOOTH_MORE)
|
||||
return convert_image(image, max_line_len, img_width, palette)
|
||||
|
||||
def convert_image(image, max_line_len, img_width, palette):
|
||||
|
Loading…
Reference in New Issue
Block a user