Image size in HTML
To change the size of an image in HTML you can use attributes width and height of img tag.
The image's original dimensions are 100 by 111 pixels.
The HTML code to locate this picture is:
<img src="sample.gif" width="100" height="111">
Always specify the location of every image on a web page. This makes the loading of the page a bit faster, because the browser doesn't need to calculate the size of each image. This is especially important for images placed inside a table. The table will not be displayed until all the images will be fully loaded.
Width and height can be either increased or decreased. However, this doesn't affect load speed of the image, because the file size is actually the same. Therefore be cautious to reduce the size of a high-resolution image, as this may cause a confusion among readers, as to why it take so long to boot for such a small picture. But increasing the size has an opposite effect - the size of the image is huge, but a file of similar size is loaded faster.
Below is an image with twice the width and height (200 x 222).
And the corresponding HTML code is:
<img src="sample.gif" width="200" height="222">
The algorithm used by browsers to resample (resize) the image, can not compete with graphical editors. That is why changing the size of the image is recommended only in some cases, because this leads to poor picture quality. It's better to use graphics program. Exceptions are images containing rectangular areas. The pattern below has only 54 bytes and it's original size is 8 by 8 pixels, increased to 150.
The image has no distortions, not surprisingly, because all the lines are vertical and horizontal.