EIW Fall 2000 Lecture Notes - HTML and Images


Images

You can include images in your HTML document using the IMG tag. The actual images themselves can be anywhere on the WWW, so your web page can include images that come from another site. The IMG tag has one required attribute - the SRC attribute specifies the URL that contains the image. Typically the URL will indicate a static file that contains either a GIF or JPG image (two standard file formats for images)

.

A simple example of an IMG tag and what this looks like when the browser renders it:

Here is my image: <IMG SRC=cookie.gif>
  

Here is my image:

There are a number of optional attributes to the IMG tag that can alter how the image is rendered by the browser, some are listed below.

IMG tag optional attributes:

Image File Format: GIF vs. JPG

The two image file formats supported by most browsers are GIF and JPG (pronounced jaypeg, and there are differences you might want to be aware of.

GIF JPG
Max. # of colors 256 Tens of thousands
Compression Lossless compression
(doesn't compress much, but nothing is lost)
Great compression,
but with some loss
Transparency Yes NO
Interlacing Yes NO
Animations Yes NO

Generally GIF format is used for icons, drawings and anything requiring animation. JPG is typically used for photographs.