--dither option

This commit is contained in:
Gordon Shumway 2019-04-26 02:41:39 -04:00 committed by GitHub
parent eb590994d7
commit 6a02da4a5f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 2 deletions

View File

@ -351,7 +351,10 @@ class ASCII(callbacks.Plugin):
image2 = image2.convert('RGB')
image2 = ImageOps.autocontrast(image2)
image2 = image2.resize((cols, rows), Image.LANCZOS)
image2 = image2.convert('P', dither=Image.FLOYDSTEINBERG, palette=Image.WEB)
if 'dither' in optlist:
image2 = image2.convert('P', dither=Image.FLOYDSTEINBERG, palette=Image.WEB)
else:
image2 = image2.convert('P', dither=None, palette=Image.WEB)
image2 = image2.convert('RGB')
lumamap = np.array(image)
colormap = np.array(image2)
@ -478,7 +481,10 @@ class ASCII(callbacks.Plugin):
image2 = image2.convert('RGB')
image2 = ImageOps.autocontrast(image2)
image2 = image2.resize((cols, rows), Image.LANCZOS)
image2 = image2.convert('P', dither=Image.FLOYDSTEINBERG, palette=Image.WEB)
if 'dither' in optlist:
image2 = image2.convert('P', dither=Image.FLOYDSTEINBERG, palette=Image.WEB)
else:
image2 = image2.convert('P', dither=None, palette=Image.WEB)
image2 = image2.convert('RGB')
lumamap = np.array(image)
colormap = np.array(image2)