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!
Asked
Active
Viewed 761 times
10
-
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: http://tex.stackexchange.com/questions/47024/how-to-scale-and-clip-a-path-at-the-same-time – 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 http://tex.stackexchange.com/a/58873/2552 can help – Jake Jul 13 '12 at 12:04
1 Answers
15
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}

Paul Gaborit
- 70,770
- 10
- 176
- 283