-
Notifications
You must be signed in to change notification settings - Fork 45
/
clipping_image.tex
33 lines (24 loc) · 872 Bytes
/
clipping_image.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
% Answer for http://tex.stackexchange.com/a/193592/828 using http://commons.wikimedia.org/wiki/Frog#mediaviewer/File:Masked_tree_frog_head.JPG from Wikimedia
\documentclass{article}
\usepackage{graphicx}
\usepackage{tikz}
\usepackage{lipsum}
\usepackage[active,tightpage]{preview}
\PreviewEnvironment{tikzpicture}
\newcommand{\imsize}{\linewidth}
\newlength\imagewidth
\newlength\imagescale
\begin{document}
\lipsum[1]
\renewcommand{\imsize}{0.618\linewidth}
\pgfmathsetlength{\imagewidth}{\textwidth}%
\pgfmathsetlength{\imagescale}{\imagewidth/851}%
\begin{figure}[htb]
\begin{tikzpicture}[x=\imagescale,y=-\imagescale]
\clip (851/2, 567/2) circle (567/2);
\node[anchor=north west, inner sep=0pt, outer sep=0pt] at (0,0) {\includegraphics[width=\imagewidth]{Masked_tree_frog_head}};
\end{tikzpicture}
\caption{My image}
\end{figure}
\lipsum[1]
\end{document}