[Tex/LaTex] Figure inset in right bottom corner – non transparent

floatsgraphicspositioning

I have 2 pdf images: 1.pdf and 2.pdf.
Now I would like to have 2.pdf as an inset (in the right bottom corner) in the Figure 1.pdf.

My question is almost similar to this ; however I only want 1 image with 1 inset figure.

Furthermore, when I tried to alter some of the TeX code, I obtained a transparent figure inset of 2.pdf in the image 1.pdf, and I don't want this.

It would even be fine if there would be a white box around the inset of 2.pdf.

Can someone please help me?

Best Answer

There are two issues, it would appear from the OP's comments: 1) insetting an image, and 2) eliminating/masking the transparancy of the inset. I will address the issues in turn:

IMAGE INSET

Here I give two examples using \stackinset. The first flush to the bottom right corner, and the second with some border. I use \includegraphics for the images, but tikz code or similar things can go in their place.

\documentclass{article}
\usepackage{stackengine,graphicx}
\begin{document}
\noindent\stackinset{r}{}{b}{}{\includegraphics[width=2in]{example-image-A}}
  {\includegraphics[width=\textwidth]{example-image-B}}\medskip

\noindent\stackinset{r}{15pt}{b}{25pt}{\includegraphics[width=2in]{example-image-A}}
  {\includegraphics[width=\textwidth]{example-image-B}}
\end{document}

enter image description here

Here's a version with a white border:

\documentclass{article}
\usepackage{stackengine,graphicx,xcolor}
\begin{document}
\fboxrule=5pt\relax
\fboxsep=0pt\relax
\noindent\stackinset{r}{}{b}{}
  {\color{white}\fbox{\includegraphics[width=2in]{example-image-A}}}
  {\includegraphics[width=\textwidth]{example-image-B}}\medskip
\end{document}

enter image description here

MASKING INSET TRANSPARANCY

To deal with a transparent inset image-A, place it on a white \colorbox:

\documentclass{article}
\usepackage{stackengine,graphicx,xcolor}
\begin{document}
\fboxrule=5pt\relax
\fboxsep=0pt\relax
\noindent\stackinset{r}{}{b}{}
  {\colorbox{white}{\includegraphics[width=2in]{example-image-A}}}
  {\includegraphics[width=\textwidth]{example-image-B}}\medskip
\end{document}