Images
Images always spice up your website when you have groups of text and tables. In the following section, you'll read about the different kinds of file formats for images, how to put images on your pages, and quite possibly everything you need to know about images.
• Graphic Interchange Format (GIF)
GIF is a file format that uses a lossless compression. They are limited to 256 colors so they result in a specific numeric pattern. Colors are often replaced by a color close to it, for example, neon blue with sky blue. GIFs are suggested for line-drawn images, which are graphics that have few lines. They are also suggested for images with few, flat colors. These are graphics that have few colors, no light sources or gradations in one color. Here's an example of what you would save as a GIF.

• Joint Photographic Experts Group (JPEG/JPG)
JPEG is a file format that uses a lossy compression. They allow high quality compression while still having millions of colors. JPEGs are suggested for images with a lot of colors, graphics with gradient fills, and graphics with light sources. They are also suggested for greyscale images with subtle gradations and photographs that have a lot of gradation, like sunsets, skies, and oceans. Here's an example of what you would save as a JPEG.


• Now that you know more about the types of images, optimizing those images come next. When left without optimizing, your images are pretty big, which increases the loading time of your site. Optimizing images allow faster download times while keeping the highest quality able to be produced. There are a range of optimization tools, from shareware to expensive. Adobe Systems makes graphic design products for professionals. Macromedia makes powerful Web production software. Corel makes products such as CorelDraw and PhotoPaint that have a range of tools towards graphics design. Jasc makes a very popular program called Paint Shop Pro that is low cost but still has powerful imaging properties. Ulead offers some compression and design products for Windows users. The GNU Image Manipulation Program (GIMP) is a popular source for graphic design and image manipulation.
• Now that we got all the preliminary stuff over with, let's get on to the fun part. Adding images to your web pages. You were introduced to the img element back in the linking tutorial, but this will help you understand it better. The image element (img) is an empty element therefore it does not require a closing tag. To put an image on your site just include the src attribute and the filename of the image. Here's an example below:



width='x'
height='x'
border='x'
align='x'
alt='description of image'
hspace='x'
vspace='x'
• You can change the width and the height of an image by specifying what their new sizes will be but make sure they are proportional or else they will look disproportional and that will draw away from the total page design. Height and width can be specified in pixels. If you do not specify the height and the width, the entire image will show up. Here's an example of the above picture resized by the height and width attributes.
![]()

• Let's say you want to put text next to the image but you wanted to keep a little space around the image so the text wouldn't look cluttered against the image. You'll need to use the vspace and the hspace attributes. Look at the first example of text and an image without space and look at the second example with the space added and figure out which one you like better.
<img src='gif.gif' border='0' align='right'>I am a gif, please do not use lots of colors on me, or I will not look very good. I can only have a maximum of 256 colors which is why if you need to use 16 million colors, save it as a JPEG. I can only do so much being a GIF. I'm only good for text or line art such things. If you have few colors, that works too.
I am a gif, please do not use lots of colors on me, or I will not look very good. I can only have a maximum of 256 colors which is why if you need to use 16 million colors, save it as a JPEG. I can only do so much being a GIF. I'm only good for text or line art such things. If you have few colors, that works too.
<img src='gif.gif' border='0' align='right' hspace='40' vspace='10'>I am a gif, please do not use lots of colors on me, or I will not look very good. I can only have a maximum of 256 colors which is why if you need to use 16 million colors, save it as a JPEG. I can only do so much being a GIF. I'm only good for text or line art such things. If you have few colors, that works too.
I am a gif, please do not use lots of colors on me, or I will not look very good. I can only have a maximum of 256 colors which is why if you need to use 16 million colors, save it as a JPEG. I can only do so much being a GIF. I'm only good for text or line art such things. If you have few colors, that works too.
• As you recall from the linking tutorial, to link an image, all you have to do is incorporate the anchor element with the image element. I will make another example in case you didn't read the linking tutorial or you have forgotten the code.
<a href='hello.html'><img src='hello.gif' border=0></a>
• This ends the tutorial over images. Please take this information with you as you go on to the multimedia section.