Cutting an image to get rounded corners
In the previous recipe, we obtained an image with sharp corners. However, there might be instances where you’d prefer rounded corners. Let’s see how to achieve this neat effect.
How to do it...
We will use a few features of a very modern (La)TeX graphics package called TikZ. People usually spell it that way. Its name and features are explained in Chapter 6, Creating Graphics, where we will talk much more about it. Follow these steps:
- Load the tikz package in your preamble:
\usepackage{tikz}
- Declare a box for storing the image:
\newsavebox{\picbox}
- Define a macro that allows us to use our recipe repeatedly:
\newcommand{\cutpic}[3]{ \savebox{\picbox}{\includegraphics[width=#2]{#3}} \tikz\node[draw, rounded corners=#1, line width=4pt, color=white, minimum width=\wd\picbox, minimum height=\ht\picbox, path picture = { &...