Skip to content

Commit

Permalink
Show input image in ASCII example
Browse files Browse the repository at this point in the history
  • Loading branch information
adrhill committed Feb 7, 2022
1 parent d3ebff3 commit 9597d45
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions docs/literate/ascii.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ using Images
using DitherPunk
using TestImages

# When loading an image, we need to compensate for the aspect ratio of ASCII characters.
img = testimage("cameraman")
img = imresize(img, ratio=(1//14, 1//6))

# When loading an image, we need to compensate for the aspect ratio of ASCII characters.
img = imresize(img; ratio=(1//14, 1//6))

# We then define an ASCII ramp and a corresponding grayscale color scheme of matching length.
ascii_ramp = split(" .:-=+*#%@", "")
cs = Gray.(range(0, 1, length=10))
cs = Gray.(range(0, 1; length=10))

# Dithering will return an `IndirectArray`:
d = dither(img, FloydSteinberg(), cs)
Expand Down

0 comments on commit 9597d45

Please sign in to comment.