General ⇒ Shaping an Image
Shaping an Image
I new to Latex and I want to know if there is a way to cropping pictures into non-rectangular shapes in Latex
Tks...
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Shaping an Image
Best regards an welcome on Board
Thorsten
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Shaping an Image
Code: Select all
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{figure}
\centering
\includegraphics{ctanlion.jpg}
\caption{The whole \TeX\ lion.}
\end{figure}
\begin{figure}
\centering
\begin{tikzpicture}
\clip (0,0) circle (4cm);
\pgftext{\includegraphics{ctanlion.jpg}};
\end{tikzpicture}
\caption{The \TeX\ lion cropped by a circle.}
\end{figure}
\begin{figure}
\centering
\begin{tikzpicture}
\clip (0,4) ..controls +(120:2cm)
and +(90:2cm) .. (-4,3) .. controls +(-90:2cm) and +(90:3cm) ..
(0,-5) .. controls +(90:3cm) and +(-90:2cm) ..(4,3) .. controls
+(90:2cm) and +(60:2cm) .. (0,4);
\pgftext{\includegraphics{ctanlion.jpg}};
\end{tikzpicture}
\caption{The \TeX\ lion cropped by a heart.}
\end{figure}
\end{document}
Edited: The lion's image can be obtained at different formats and resolutions from http://www.ctan.org/lion.html
The path for the cropping heart has been borrowed (and slightly modified) from http://www.fauskes.net/pgftikzexamples/valentine-heart/
- Attachments
-
- ctanlion.jpg (37.3 KiB) Viewed 5015 times