Setting the img tag to <img ... width="48" height="27" > does not change the actual size of the image. It only changes the size the image is displayed.

Here's the image.

Here's that same image drawn from the same tag into a canvas. View the source of the page.

For all HTML Elements, there's a content size and a display size. CSS chooses the display size, Other things choose the content size.

For images it's the image data. For video it's the video data. For SVG it's defined in the SVG. For Canvas tags it defaults to 300x150 setting it's width/height sets the initial size of the canvas's content. It's display size is still determined by CSS.