Zalgo Art Open the tool

Updated

The zalgo command line tool

Everything the site does is also a command, zalgo. The site and the command run the same file, and the project's tests compare their output byte for byte.

Install

It needs Node.js 18 or newer. There are no packages to install.

git clone https://github.com/jackulau/ZalgoArt.git
cd ZalgoArt
./bin/zalgo text "hello"

To have zalgo on your path:

npm install -g https://github.com/jackulau/ZalgoArt/archive/refs/heads/main.tar.gz

It is not on the npm registry, so install from the tarball as shown.

Commands

CommandWhat it does
zalgo image <file>Turn a picture into one line of text
zalgo text <words...>Write words in big letters built from marks
zalgo glitch <text...>Classic glitch text
zalgo count [file]Count text every way a platform might
zalgo check [file]Will this text arrive whole on a platform
zalgo platformsThe platforms, their limits and how well each is checked
zalgo helpEvery option

What a run looks like

The text goes to standard output and a summary to standard error, so a pipe or a redirect carries only the text. This is the summary for zalgo glitch "hello" -p x:

X (280): 125 of 280 weighted characters
  2.1 em wide, 3.5 em up, 2.9 em down
  7 lines: 3 reserved above, 3 below
  marks: 12 above, 12 below, 1 through, seed 7, font Helvetica
  [ok]   125 of 280 weighted characters.
  [warn] A pile on a blank or an ordinary letter comes out flat on X in Firefox: X's own font draws the letter and the marks are left with nothing to stack on. Chrome and Safari stack it. Only a column standing on ˍ stacks in all three.
  [ok]   Already normalised (NFC), so the platform has nothing to rewrite.
  [ok]   About 2.1 em wide, inside a phone column (20.5 em).
  [ok]   Stacks stay inside the post box (7 lines).
  [note] X counts every mark as 1 and an invisible spacer as 2. Picture columns stand on ˍ, which X's own font lacks, so the system font draws the whole column and stacks it. Checked with X's fonts in Chrome, Firefox and Safari's engine on macOS. The compose box, Windows and the phone apps were not.
  [note] Layout measured on the live site (Chrome, macOS). Other devices use other fonts.

The exit code is 0 when the checks pass, 1 when a check failed and 2 when the command could not be run, so zalgo check can gate a script. --json prints the text, the counts, the checks and the options used.

Pictures

PNG files are read directly on any system. JPEG, GIF, HEIC and WebP are converted with sips, which ships with macOS. On other systems, convert to PNG first.

Every option

This is what zalgo help prints.

zalgo: pictures, lettering and glitch text made of stacked combining marks, sized so a post arrives intact.

Usage
  zalgo image <file>           turn a picture into one line of text
  zalgo text <words...>        write words in big letters built from marks (or pipe them in)
  zalgo glitch <text...>       classic glitch text (or pipe the text in)
  zalgo count [file|-]         count text every way a platform might
  zalgo check [file|-]         will this text arrive intact on a platform
  zalgo platforms              the platforms, their limits and how well each is verified
  zalgo help                   this text

Options
  -p, --platform <id>          where the text will be posted (default x). See: zalgo platforms
      --limit <n>              use this length limit instead of the platform's (mainly for -p custom)
      --font <name>            font profile: helvetica (default) or arial
      --metrics <file>         a font profile saved from the page, instead of --font
  -o <file>                    write the text to a file instead of standard output
      --copy                   also put the text on the clipboard (macOS)
      --json                   print text, counts, checks and the options used as JSON

  image
      --cols <n>               columns. Leave out to fit the platform
      --tones <n>              shades of grey, 1 to 12. Leave out for automatic
      --marks tall|short       tall marks cost fewer characters, short ones give more detail (default tall)
      --base <id>              what each column stands on: blank, wide, auto, l, i, dot, o, low, point, delta (default: low on x, point on slack, blank elsewhere)
      --baseline <n|auto>      where the letter row sits, percent from the top (default auto)
      --cutoff <n>             how far from the background counts as subject, percent (default 10)
      --invert                 swap ink and paper
      --theme light|dark       the reader's theme: dark text on light, or light on dark (default light)
      --dither                 mix tones for smoother shading
      --no-room                do not reserve empty lines for tall stacks
      --pad blank|dot          what a reserved line holds: an invisible character or a full stop (default blank)
      --no-phone               allow lines wider than a phone screen
      --dense                  allow more than 30 marks in a column. Bigger pictures, but Safari and the
                               iPhone, iPad and Mac apps stack only the first 30 (also for glitch)

  text
      --size <n|auto>          letter size, 1 (smallest) to 6. Leave out for the largest that fits
      --rows <1|2|auto>        one row of letters, or two: the second hangs below the line (default auto)
      --caption <text>         a line of ordinary text above the letters
      --side above|below|auto  one row of letters stands on the line or hangs from it.
                               Leave out for whichever needs fewer marks
      --base, --no-room, --pad, --no-phone, --dense   as for image

  glitch
      --up <n> --down <n>      marks above and below each letter (default 12 and 12)
      --through <n>            strike-through marks per letter (default 1)
      --seed <n>               same seed, same text (default 7)
      --no-fit                 do not thin the marks to fit the platform
      --no-room, --pad         as for image

The text goes to standard output and a summary to standard error, so pipes carry only the text.
Exit code: 0 the checks pass, 1 a check failed, 2 the command could not be run.
PNG is read directly. JPEG, GIF, HEIC, WebP and other formats are converted with sips (macOS).

Examples
  zalgo image photo.png                         fit X, print the text
  zalgo image photo.jpg -p bluesky --copy       fit Bluesky, copy to the clipboard
  zalgo image logo.png -p discord --cols 40 --tones 3 -o post.txt
  zalgo image photo.png -p custom --limit 1000 --json
  zalgo text "zalgo art" -p xpremium             two rows of big letters
  zalgo text zalgoart --caption Introducing     a normal X post: plain caption, letters below
  zalgo glitch "he comes" -p mastodon --up 20 --seed 3
  echo hello | zalgo glitch -p sms
  zalgo check post.txt -p x
  zalgo image photo.png | zalgo count

The same thing in a browser

The site has the same four sources with a live preview: image, text, draw and glitch. The limits both use are listed under character limits by platform.