💀 DitherPunk.jl 💀
Documentation | Build Status |
---|---|
A dithering / digital halftoning package inspired by Lucas Pope's Obra Dinn and Surma's blogpost of the same name. Check out the gallery for an overview of all currently implemented algorithms.
Installation
To install this package and its dependencies, open the Julia REPL and run
julia> ]add DitherPunk
Examples
using DitherPunk
using Images
using TestImages
img = testimage("fabio_gray_256") # load an image
d = dither(img, FloydSteinberg()) # apply algorithm of your choice
dither!(img, FloydSteinberg()) # or in-place modify image
All algorithms can be used for binary or channel-wise dithering:
Error diffusion | Ordered dithering | Digital halftoning |
---|---|---|
All error diffusion, ordered dithering and halftoning methods support custom color palettes. Define your own palette or use those from ColorSchemes.jl:
using DitherPunk
using ColorSchemes
dither(img, FloydSteinberg(), ColorSchemes.flag_us)
flag_us |
PuOr_6 |
websafe |
---|---|---|
DitherPunk also lets you generate optimized color palettes for each input image:
using DitherPunk
ncolors = 8
dither(img, FloydSteinberg(), ncolors)
2 colors | 8 colors | 32 colors |
---|---|---|
For a more in-depth introduction, take a look at the docs.
Share your creations in the discussions tab and leave a GitHub Issue if you know of any cool algorithms you'd like to see implemented!