You can do something css like:
img.overlay {
margin:auto;
position:absolute;
left:0;
right:0;}
reference: http://codepen.io/shshaw/full/gEiDt
I believe you can go with position:fixed as well :)
EDIT: like this:
<div>text before the image</div>
<div style="position:relative;">
<img src="A.png" style="visibility:hidden;" /> <!-- spacer -->
<img src="A.png" class="overlay" />
<img src="B.png" class="overlay" />
</div>
<div>text after the image</div>