3

How should I crop an image to use in a tikzpicture?

I declare an image in my header

\pgfdeclareimage{myimage}{image.png}

Then I want to use a cropped version of myimage in a tikzpicture

\begin{tikzpicture}
    [...things being drawn...]
    \pgfuseimage{image}
\end{tikzpicture}

Is there an option akin to \includegraphics[trim={0 1cm 0 0}]{image}?

  • 5
    why not \node[inner sep=0pt]{\includegraphics[trim={0 1cm 0 0}]{image}};? – Ignasi Jun 26 '18 at 13:13
  • @CarLaTeX Done! – Ignasi Apr 23 '19 at 8:34
2

An \includegraphics command can be used in node's contents part, therefore if \includegraphics[trim={0 1cm 0 0}]{image} is the desired solution, just insert it into a node:

\node[inner sep=0pt]{\includegraphics[trim={0 1cm 0 0}]{image}};

inner sep=0pt is included to avoid any empty space between the image and node's border.

|improve this answer|||||

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.