Crossed out red box fitting tightly around image

A TikZ solution that includes the image file inside a tikzpicture and draws a square and cross relative to the coordinates of the image:

\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
    \node[inner sep=0] (image) at (0,0) {\includegraphics[width=0.5\textwidth]{example-image}};
    \draw[red,ultra thick] (image.south east) -- (image.north west);
    \draw[red,ultra thick] (image.north east) -- (image.south west);
    \draw[red,ultra thick] (image.south west) rectangle (image.north east);
\end{tikzpicture}
\end{document}

enter image description here


as supplement to @Marjin answer (+1), a little bit shorter code ...

\documentclass{article}
\usepackage{tikz}
\begin{document}
    \begin{tikzpicture}
\node  (image) [inner sep=0] {\includegraphics[width=0.5\textwidth]{example-image}};
\draw[red,ultra thick]  (image.south west) -- (image.north east)
                        (image.north west) -- (image.south east)
                        (image.south west) rectangle (image.north east);
    \end{tikzpicture}

the result is similar:

enter image description here

Tags:

Graphics

Boxes