10

I would like to write some text in latex, then replace the black of the letters by a transparent layer, and overlay on top of a PDF photo. I could do it by exporting to photoshop, but I would like a latex-only solution. Thanks!

  • Could you provide an example? How much text are we talking about, one word, a sentence, a whole paragraph? – Jake Jul 13 '12 at 10:23
  • I don't really understand the question but if I interpreted right you want something like this: tex.stackexchange.com/questions/47024/… – szantaii Jul 13 '12 at 11:15
  • @szantaii: I don't think that's what the OP wants: In the solution you linked to, a simple shape is used for clipping a block of text. The OP wants to use the shape of the letters to clip a photo, if I understand correctly. Maybe tex.stackexchange.com/a/58873/2552 can help – Jake Jul 13 '12 at 12:04
14

Here's a solution with tikz using scope fading and tikzfadingfrompicture.

\documentclass{standalone}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{tikz}
\usepackage{lipsum}
\usetikzlibrary{fadings}
\begin{tikzfadingfrompicture}[name=lipsum]
  \node
  [anchor=south west,text=transparent!0,text width=6cm,font=\bfseries\scriptsize]
  {\lipsum[1]};
\end{tikzfadingfrompicture}
\begin{document}
\begin{tikzpicture}
  \fill [black!20] (-3cm,-3.2cm) rectangle (3cm,3.2cm);
  \node[scope fading=lipsum,fit fading=false,fill=white,minimum size=6.4cm]{};
  \node[scope fading=lipsum,fit fading=false]{\includegraphics[width=6.4cm]{tiger}};
\end{tikzpicture}
\end{document}

enter image description here

  • 1
    `` `` Sweet!! `` `` – percusse Jul 13 '12 at 17:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.