When importing an HTML file to Microsoft Word, inline image dimensions are ignored. For example, the following HTML code:
<html>
<body>
<div>
here's an image 50px in height:
<img height=50 src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAT4AAACfCAMAAABX0UX9AAAAMFBMVEUMETYmKD8AADFlZnCQkZcAACwkJj6Xl5wWGTU5O0oFDDUAACUeIDqpqaxfYGtvcHd51QkgAAABV0lEQVR4nO3QwQGCMAAAsaIIKqj7bysz9L7JCBn7c2HS9hrrYzDpvekrFn2FvkRfoi/Rl+hL9CX6En2JvkRfoi/Rl+hL9CX6En2JvkRfoi/Rl+hL9CX6En2JvkRfoi/Rl+hL9CX6En2JvkRfoi/Rl+hL9CX6En2JvkRfoi/Rl+hL9CX6En2JvkRfoi/Rl+hL9CX6En2JvkRfoi/Rl+hL9CX6En2JvkRfoi/Rl+hL9CX6En2JvkRfoi/Rl+hL9CX6En2JvkRfoi/Rl+hL9CX6En2JvkRfoi/Rl+hL9CX6En2JvkRfoi/Rl+hL9CX6En2JvkRfoi/Rl+hL9CX6En2JvkRfoi/Rl+hL9CX6En2JvkRfoi/Rl+hL9CX6En2JvkRfoi/Rl+hL9CX6En2JvkRfoi/Rl+hL9CX6En2JvkRfoi/Rl+hL9CX6En2JvuTqO27MOsfne2fW7w+KdA3sU/NzBAAAAABJRU5ErkJggg==">
</div>
</body>
</html>
looks like this in a browser:
but, looks like this in Word (note the huge size relative to the 12-pt font):
How do I get the image in Word to scale to the correct size? Please note:
- Adding
style="height:50px;width:100px;max-width:100px;max-height:50px;"to the img tag has no effect on the Word result - The source image must be inline (
src="data:...and cannot be saved in a separate file) - Reducing the dimensions of the encoded data is not and option, because the resolution becomes unacceptably low (it won't matter for the image provided in this example, but it will matter a lot for the actual images this is to be used for)

