I am newbie in Tikz. I would like to place a png or pdf image on another pdf figure using Tikz overlay.Unfortunately i don't have any Tikz code for both the figures.
I have looked at this answer using How to put a PDF figure on top of another one using Tex Commands, Drawing Image on Tikz and the closest example Image inside another image.
My question is to overlay images at correct locations keeping the aspect ratios of two figures using Tikz ?.
I have used overpic package and Tikz here in MWE(not working correctly now)
Here is the minimal working example. The caption for Tikz is not placed properly. any idea why ?
For a quick preview of output at writelatex
\documentclass[12pt]{article}
\usepackage{mwe,tikz}
\usepackage[percent]{overpic}
\pagestyle{empty}
\begin{document}
\begin{figure}
\centering
\begin{overpic}[scale=0.75]{example-image-a}
\put(3,3){\includegraphics[scale=0.21]{example-image-b}}
\end{overpic}
\caption{Using Overpic}
\end{figure}
\begin{figure}
\centering
\begin{tikzpicture}[overlay]
\node at (1,1) {\includegraphics[scale=1]{example-image-a}};
\node at (1.5,1) {\includegraphics[scale=0.25]{example-image-b}};
\end{tikzpicture}
\caption{Using Tikz Overlay}
\end{figure}
\end{document}
Result:


overlayis not required in this case. You can put "things on top of other things" simply drawing them in the appropriate order. Theoverlaykeyword is used to mean that the resulting tikzpicture has to be overlayed by the surrounding text or other pictures. More formally, it causes the resulting picture to have zero size. Simply removeoverlayand it would work. – JLDiaz Jan 25 '13 at 00:13atare refered to the node'sanchorwhich is its center by default. You can setanchor=south westto specify the coordinates of the lower left corner, for example. – JLDiaz Jan 25 '13 at 00:14overlayremoved,node[ anchor=north east]applied. How to set the co-ordinates for image-b ? – texenthusiast Jan 25 '13 at 00:25