Rendering text as image to protect e-mail address

I want to protect my e-mail address against spammers by including it as image instead of a (parsable) text. Normally I would have to create the image (with text) by myself and include this as figure. Is there a way of automatizing this (e.g. a package)?

• Welcome to TeX.SX! Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – user31729 Apr 16 '15 at 11:13
• See tex.stackexchange.com/questions/150375/…, for example, and other related questions. – Steven B. Segletes Apr 16 '15 at 11:21
• – Karalga Apr 16 '15 at 11:25
• Thank you for pointing me to that, I already saw these posts. I am looking for a picture only solution which does not involve a third application as the domain should be obfuscated as well.. – Akantor Apr 16 '15 at 11:35
• There is also the randtext package. – TonioElGringo Apr 16 '15 at 11:49

You can use this with pdflatex --shell-escape

\documentclass{article}
\usepackage{graphicx}

\def\hideemail#1#2{%
\IfFileExists{#1.png}{}%
{\immediate\write18{%
echo '\detokenize{\setbox0\hbox{\strut #2}\hoffset-1in\voffset-1in\pdfpageheight\baselineskip
\pdfpagewidth\wd0\shipout\box0\bye'|pdftex;convert -density 600 texput.pdf #1.png}}}%
\box0{#2}%
\raisebox{-\dp\strutbox}{\includegraphics[width=\wd0]{#1.png}}}%

\begin{document}

some text with \hideemail{myemail}{david@example.com} an address

\end{document}


The exact command sequence written to the \write18 line depending on the utilities and operating system you have available. It uses plain pdftex to write a pdf just containing the address, then imagemagic convert to make a png.

the result is

However this gives absolutely no security to the email address, for example if I load the pdf (or even the png image of the pdf as uploaded to this site) into google docs it OCRs it automatically producing

 some text with david@example.com an address


as plain text.

If google can OCR that automatically on file upload, so can whoever you are trying to hide this from.