# How to color a framebox around an image

I have made two images where one of them is an inset (image B) as shown.

I would like to know can I color the frame around image B to blue!40 ? Can anyone help?

Many thanks!

I have included the frame around image B (by default it is black in colour) using the following tikz/latex commands.

\begin{figure}
\begin{tikzpicture}
\node(a){\includegraphics[width=.70\textwidth]{ia.eps}};
\node(b)[inner sep=0pt,left = 1cm of a] {\phantom{\includegraphics[width=.31\textwidth]{ib.eps}}};
\node(c)[draw, blue!40, minimum size=0.05cm, at=(a)]{};
\begin{scope}[thin,blue!40]
\draw(c.north west) -- (b.north east);
\draw(c.south west) -- (b.south east);
\end{scope}
\node [at=(b),inner sep=0pt,left = 1cm of a]{\framebox[1.0\width]{\includegraphics[width=.30\textwidth]{ib.eps}}};
\end{tikzpicture}
\end{figure}

• To answer your question, use {\color{red}\fbox{\color{blue}B}}. But so long as you are already using tikz, you don't need \framebox. Sep 22 '15 at 22:09

Don't use \framebox but tikz facilities:

\node [draw=blue!40,thick,at=(b),inner sep=2pt,left = 1cm of a]
{\includegraphics[width=.30\textwidth]{example-image-b}};


The draw=blue!40,thick option to the node draws the border with the colour specified. You can also use line width=0.4pt instead of thick. To adjust the separation of border from image, adjust inner sep value.

\documentclass{Article}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}
\begin{tikzpicture}
\node(a){\includegraphics[width=.70\textwidth]{example-image-a}};
\node(b)[inner sep=0pt,left = 1cm of a] {\phantom{\includegraphics[width=.31\textwidth]{example-image-b}}};
\node(c)[draw, blue!40, minimum size=0.05cm, at=(a)]{};
\begin{scope}[thin,blue!40]
\draw(c.north west) -- (b.north east);
\draw(c.south west) -- (b.south east);
\end{scope}
\node [draw=blue!40,thick,at=(b),inner sep=2pt,left = 1cm of a]{\includegraphics[width=.30\textwidth]{example-image-b}};
\end{tikzpicture}
\end{document}


Just for the sake of it, if you want the hard way, it is \fcolorbox which does this job.

 \fcolorbox{<border color>}{<fill color>}{content}


Sample:

\documentclass{article}
\usepackage{graphicx}
\usepackage{xcolor}
\begin{document}
\fcolorbox{blue!40}{white}{\includegraphics[width=.30\textwidth]{example-image-b}}
\end{document}


Here the default line thickness is 0.4pt and the separation between image and border is \fboxsep (which is 3pt by default).