The following code works absolutely fine:
\documentclass[varwidth=\maxdimen]{standalone}
\usepackage{overpic}
\begin{document}
\begin{figure}
\fbox{\begin{overpic}[unit=30mm]{example-grid-100x100bp.jpg}
\end{overpic}}%
\fbox{\begin{overpic}{example-grid-100x100bp.jpg}
\end{overpic}}
\end{figure}
\end{document}
and gives the following image:
However, when I simply change
\usepackage{overpic} to \usepackage[abs]{overpic}, or
\begin{overpic}[scale=0.02, unit=30mm]{example-grid-100x100bp.jpg} to \begin{overpic}[abs, scale=0.02, unit=10mm]{example-grid-100x100bp.jpg}, I get:
So basically the second image is now overlapping on the first.
I would have expected the 2 images to simply be side to side, instead of overlapping as in the second image. I would have expected that setting unit to some value should not change the position of the plot, but it does.
Is this a bug, or am I misunderstanding something?
My main use case of \overpic is that it allows to put text on the graphics, for example like this:
\begin{figure}
\fbox{\begin{overpic}[abs, unit=30mm]{example-grid-100x100bp.jpg}
\put(0.5, 0.5){hello}
\end{overpic}}%
\fbox{\begin{overpic}{example-grid-100x100bp.jpg}
\end{overpic}}
\end{figure}
which gives me:
EDIT: as suggested in comments, I added a \fbox around the \overpic to show that overpic seems to think that the figure is now smaller.
Seems to be related to this question:overpic overlap box frame
(image from here:http://mirrors.ctan.org/macros/latex/contrib/mwe/example-grid-100x100bp.jpg)




\fbox{\begin{overpic}....\end{overpic}}you can see that the size of the first image (underabs) if smaller than the actual image and this it appears to be overlapping – daleif Apr 13 '23 at 14:31[abs, unit=30mm](which should just set the unit and the positional option), makes overpic believe that the image is now smaller than what is actually is? That doesn't sound right – Chachni Apr 13 '23 at 14:35