Add border to all images

Viewed 44

I have a document that has a handful of figures in it, and I am using

\tcbox{\includegraphics{./Pictures/image-name.png}}

to put a border around them. I end up repeating this for every image though. Is there a way to put something at the top of my document that says to apply this to all images?

1 Answers

If nothing else in your document relies on \includegraphics, you could try the following redefinition:

\documentclass{article}

\usepackage[most]{tcolorbox}

\let\includegraphicsold\includegraphics
\renewcommand{\includegraphics}[2][]{\tcbox{\includegraphicsold[#1]{#2}}}

\begin{document}

\includegraphics[width=10cm]{example-image-duck}



\end{document}
Related