<img src="https://dummyimage.com/150x150.png" width="200px" height="200px"  />

<img src="https://dummyimage.com/300x100.png" width="200px" height="200px"  />

<img src="https://dummyimage.com/100x300.png" width="200px" height="200px"  />
img {
  background: red;
  object-fit: contain;
}

body {
  height: 100vh;
  display: flex;
  justify-content: space-evenly;
  align-items: center;
  gap: 4px;
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.