User:Rewood/Determining the Size of an Image File

From WolfTech
Jump to navigation Jump to search

When including images in web pages, it is beneficial to include the width and the height of an image in the IMG tag.

By adding the WIDTH and HEIGHT attributes to the IMG tag, the user's browser knows how much space to allow for the image and will display the rest of the page without waiting for the image to be transferred.

There are several applications that will indicate the dimensions in terms of pixels. Probably the easiest for gathering this information, that you are familiar with, is Mozilla.

To determine the dimensions of an image file (either jpeg or gif formats), open the image into the Navigator window.

  • If the image is already in a web page, right-click on the image and select View Image.
  • If the image file is on the WWW, enter the URL of the image in the "Location" pane.
  • If the image file is in your directory, select File, Open File ... .

The title bar of the Navigator window displays the type of image (JPEG, GIF or PNG) and the dimensions in pixels. The first number is the width of the image and the second number is the height of the image. Use the directions above to find the width and height of this image. The width of this image is 75 pixels and the height is 30 pixels. To use this information in an IMG tag for an html document.