This alignment is done internally by Chrome rather than by using CSS.
If you look at the URL when you open a local file, Chrome uses file:///
rather than a standard http(s)://
URL, which Chrome detects and adjusts the layout accordingly.
Quite misleading that they have the inline CSS on the elements when it's done internally, but the layout you talk about isn't achievable with only the CSS specified above.
The default HTML when rendering an image file directly is below and as you can see it has inline style attributes on the body/img tags, but the same HTML in a standalone document renders the image in the top left corner.
UPDATE
The CSS does seem to be affecting the layout, but the same CSS in a standalone HTML document does not layout the page with the content/image vertically and/or horizontally centred.
<html style="height: 100%;">
<head>
<meta name="viewport" content="width=device-width, minimum-scale=0.1">
<title>the-head.png (700×467)</title>
</head>
<body style="margin: 0px; background: #0e0e0e; height: 100%">
<img style="-webkit-user-select: none;margin: auto;background-color: hsl(0, 0%, 90%);transition: background-color 300ms;" src="file:///C:/Users/djalx/Pictures/the-head.png">
</body>
</html>