By design: a pixel width or height in a style passed to getHtml() is taken out of the style, used to resize the image, and emitted as width and height attributes, so a 3000-pixel file is not downloaded to show at 300. Values in other units stay in the style. Resize explicitly with getResized() and style the element with a class.