body, section { padding: 20px; }

section {
	background-color: gold;
	height: 40vh;
}

section:not(:first-child) { margin-top: 20px;}

img {
	background-color: orange;
	height: 100%; /* Fill the parent. */
	width: 100%;
}

section:first-child img {
	object-fit: contain; /* Fit the image. */
	object-position: left top; /* Corner. */
}

section:last-child img {
	object-fit: cover; /* Cover the parent. */
	object-position: right center; /* Side. */
}
<!DOCTYPE html>
<html>
	<head>
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<link href="/assets/styles/reset.css" rel="stylesheet">
		<link href="style.css" rel="stylesheet">
	</head>
	<body>
		<section>
			<img src="tim.jpg" alt="Tim Berners-Lee at a computer.">
		</section>
		<section>
			<img src="tim.jpg" alt="Tim Berners-Lee at a computer.">
		</section>
	</body>
</html>