xxxxxxxxxx
<div class="parent">
<img src="image1.jpg">
</div>
//CSS:
.parent {
position: relative;
width: 300px;
height: 300px;
background-image: url(image2.jpg);
background-size: cover;
}
img {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
max-width: 100%;
max-height: 100%;
}