Skip to content

Commit

Permalink
Dither linting
Browse files Browse the repository at this point in the history
  • Loading branch information
Gadgetoid committed Nov 5, 2020
1 parent 47b2e76 commit fbe16fa
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions examples/7color/advanced/dither.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
#!/usr/bin/env python3

import sys

import hitherdither
from inky.inky_uc8159 import Inky
from PIL import Image

print("""dither.py
Advanced dithering example using Hitherdither by Henrik Blidh:
Expand All @@ -23,12 +29,6 @@
""")

import sys

from PIL import Image
from inky.inky_uc8159 import Inky
import hitherdither

inky = Inky()
saturation = 0.5 # Saturation of palette
thresholds = [64, 64, 64] # Threshold for snapping colours, I guess?
Expand All @@ -46,16 +46,16 @@

image = Image.open(sys.argv[1]).convert("RGB")
# VERY slow (1m 40s on a Pi 4) - see https://github.com/hbldh/hitherdither for a list of methods
#image_dithered = hitherdither.diffusion.error_diffusion_dithering(image, palette, method="stucki", order=2)
# image_dithered = hitherdither.diffusion.error_diffusion_dithering(image, palette, method="stucki", order=2)

# Usably quick, your vanilla dithering
#image_dithered = hitherdither.ordered.bayer.bayer_dithering(image, palette, thresholds, order=8)
# image_dithered = hitherdither.ordered.bayer.bayer_dithering(image, palette, thresholds, order=8)

# Usuably quick, half-tone comic-book feel, use order=4 for small dots and order=8 dot bigguns
image_dithered = hitherdither.ordered.cluster.cluster_dot_dithering(image, palette, thresholds, order=8)

# VERY slow
#image_dithered = hitherdither.ordered.yliluoma.yliluomas_1_ordered_dithering(image, palette, order=8)
# image_dithered = hitherdither.ordered.yliluoma.yliluomas_1_ordered_dithering(image, palette, order=8)

inky.set_image(image_dithered.convert("P"))
inky.show()

0 comments on commit fbe16fa

Please sign in to comment.