How to vertically and horizontally align an image inside div?

Please use below css to align image:
<div class="frame">
<img src="image.png">
</div>
.frame {
    display: flex;
    justify-content: center;/*center horizontally*/
    align-items: center;/*center vertically*/
}
img {
    height: auto;
}