Command line utility and (soon to be) library.
Creates a png image from text, with an easy to use command line tool and/or library.
The idea is to be able to show sensitive information and defeat Optical Character Recognition (OCR).
Useful to protect text from bots and scrapers, such as email addresses and telephone numbers in web pages, and even passwords or tokens sent via email.
The image size is calculated automatically so that the text fits, with a small margin. The background is transparent so that the image can be used on any color background.
You can change the font size (-s) also to make it harder for bots and scrapers to do OCR on the text there is an option (-w) to only fill in a percentage of the pixels at random.
If the text has spaces it must be put in quotes on the command line.
``` USAGE: text2img [OPTIONS] --output
ARGS:
OPTIONS: -h, --help Print help information -o, --output
text2img -o email.png "myemail@domain.com"
50 point font
text2img -o email.png -s 50 "myemail@domain.com"
50 point font and 30% of pixels filled in
text2img -o email.png -s 50 -w 30 "myemail@domain.com"
Currently only Roboto is supported.
The Roboto font used was copied from
/usr/share/fonts/truetype/roboto/unhinted/RobotoTTF/Roboto-Regular.ttf
Submit an issue if you would like a feature, or send a PR if you would like to contribute.
Render the text using Poisson Disks to make it even harder for OCR to work.
Currently the background is always transparent.
text2img --points 12 --font DejaVu "myemail@domain.com" email.png
echo data.txt | text2img data.png
echo data.txt | text2img --justify data.png --center --left --right
The alternatives given require the output image size to be specified.
text2image
convert -size 360x360 xc:white -font "FreeMono" -pointsize 12 -fill black -draw @ascii.txt image.png
text 15,15 " text to show
"
convert -size 360x360 xc:white -font "FreeMono" -pointsize 12 -fill black -annotate +15+15 "@ascii.txt" image.png
convert -list font | grep Font:
```
$1 | convert -background black -fill white \ -font Helvetica -pointsize 14 \ -border 10 -bordercolor black \ label:@- $2 ```