img2txt(1)

img2txt πŸ’… the glow-up your pixels deserve

okay bestie, so this is the manual page for img2txt β€” it lives in section 1 of the General Commands Manual, which is the section for user commands, iykyk. it's a little tool from the libcaca crew and it's literally here to turn your pics into text art. obsessed.


✨ NAME ✨

img2txt β€” convert images to various text-based coloured files πŸŽ€


✨ SYNOPSIS ✨

img2txt [ -W width ] [ -H height ] [ -x font-width ] [ -y font-height ]
        [ -b brightness ] [ -c contrast ] [ -g gamma ]
        [ -d dither ] [ -f format ] FILE

✨ DESCRIPTION ✨

so img2txt converts images into colour ASCII characters and outputs them into text-based coloured files. that's the whole vibe. πŸ’–

it can load basically the most widespread image formats ever: PNG, JPEG, GIF, PNG, BMP etc β€” and yes bestie, PNG is in that list twice, that's just how the manpage said it, no cap, we're keeping it. (peep the NOTES section for the details πŸ‘€)

by default the output text is 60 columns wide, and the line count gets computed accordingly so the aspect ratio of the original file is respected. and the default output format? standard ANSI coloured text. periodt.


✨ OPTIONS ✨

  • -W, --width=<width> β€” changes the output column count. if you don't give it one, the default is 60.
  • -H, --height=<height> β€” changes the output line count. if you don't give it one, the height gets computed to match the correct aspect ratio. πŸ¦‹
  • -x, --font-width=<width> β€” changes the output font width. if you don't give it one, the default is 6. this value is what gets used for computing the aspect ratio.
  • -y, --font-height=<height> β€” changes the output font height. if you don't give it one, the default is 10. this value is what gets used for computing the aspect ratio.
  • -b, --brightness=<brightness> β€” changes the image brightness. defaults to 1.0.
  • -c, --contrast=<contrast> β€” changes the image contrast. defaults to 1.0.
  • -g, --gamma=<gamma> β€” changes the image gamma. defaults to 1.0.
  • -d, --dither=<dither> β€” changes the dithering algorithm. it can be one of these (defaults to fstein):
    • none β€” nearest color
    • ordered2 β€” ordered 2x2
    • ordered4 β€” ordered 4x4
    • ordered8 β€” ordered 8x8
    • random β€” random
    • fstein β€” Floyd Steinberg
  • -f, --format=<format> β€” changes the output format. it can be one of these (defaults to ansi):
    • ansi β€” coloured ANSI
    • caca β€” internal libcaca format
    • utf8 β€” UTF8 with CR
    • utf8cr β€” UTF8 with CRLF (MS Windows)
    • html β€” HTML with CSS and DIV support
    • html3 β€” Pure HTML3 with tables
    • irc β€” IRC with ctrl-k codes
    • bbfr β€” BBCode (French)
    • ps β€” Postscript
    • svg β€” Scalable Vector Graphics
    • tga β€” Targa Image
  • -h, --help β€” displays the help message and exits. 🫢
  • -v, --version β€” displays the version of the program and exits. πŸ‘‘

✨ EXAMPLES ✨

the classics, bestie, run these and watch the magic happen:

img2txt hello.jpg > hello.ans
img2txt --width=40 --format=svg hello.jpg > tinyhello.svg

like?? tinyhello.svg?? iconic. πŸ’…


✨ NOTES ✨

setting both the column count and the line count (with --width and --height) lets you pick the exact output size without taking the aspect ratio into account. so you're the main character now, you decide. 😌

important!! you must compile the libcaca package with support of Imlib2 if you want to be able to load a wide variety of image formats. otherwise you'll only be able to load regular BMP files. so like... go get that Imlib2 support, bestie, don't settle for BMP-only energy. πŸ’€

✨ SEE ALSO ✨


✨ AUTHOR ✨

this manual page was written by Sam Hocevar <sam@hocevar.net> and Jean-Yves Lamoureux <jylam@lnxscene.org>. legends, honestly. πŸŽ€


and that's a wrap on the libcaca manual page, dated 2007-11-07, written by those two absolute icons β€” go forth and turn your JPEGs into text, bestie, you got this πŸŒˆβœ¨πŸ’–