
Images
- Images in Web pages. [ Image Examples ]
- The web page refers to the image, which is a separate file.
- <img src="http://www.website.org/some/place/here.gif" />
- The web page specifies a URL. Any of the forms used in a
are fine.
- The browser makes a separate request for the image.
- Placing images from another site.
- Allowed by HTML, but may be prevented by the server.
- Probably legal, unless part of a fraud.
- Usually rude.
- Alt attribute:
<img src="http://www.mc.edu/images/logos/mcclock.gif"
alt="MC Logo" />
- Some browsers use it as a mouse-over.
Firefox and other Mozilla family use title.
- Screen readers for blind visitors.
- Actually required, though I've never seen a browser complain.
- Width and height attributes. [ Resized Images ]
<img src="http://www.mc.edu/images/logos/mcclock.gif"
height="118" width="90" />
- Keeps the browser from having to rearrange the page when
the image finally shows up.
- Can resize the image.
- Setting one dimension retains the proportions.
- Setting both can distort the image.
- Image placement. [ Image Placement. ]
- Without any horizontal alignment, images are treated as fat characters.
- Vertical alignment:
<img src="http://www.mc.edu/images/logos/mcclock.gif"
align="top">
Also, bottom, middle.
- Horizontal alignment: align="left", align="right"and
align="middle".
Horizontal alignment also causes the text to flow around the
image.
- Space around images. Expressed in pixels.
[ Image Spacing ]
- On the sides: hspace
- Above and below: vspace
- Border width.
- Image File formats.
- Images are just arrays of numbers designating colors.
- Image data must be compressed to keep sizes reasonable.
- Lossy and lossless compression.
- Lossless: Retains all original information.
- Lossy: Trades compression for fidelity.
 |  |  |  |
| 75% 4.7K | 60% 4.5K | 40% 3K | 25% 2.6K |
- GIF (Graphics Interchange Format)
- Lossless compression.
- Indexed: 256 colors max.
- Works best with line drawings, diagrams. Generally,
a few distinct, solid colors.
- Transparent GIFs:
Transparency works best with sharp edges.
- Animated GIFs. Typically as useless as this one.

Browsers generally have options to control the animation.
- Interlaced GIFs. Look nicer when loading slowly.
- Patents.
- Unisys patent expired June 20, 2003 in the US.
- IBM holds one until Aug. 11, 2006. Likely not valid; never been
enforced.
- JPG (Joint Photographic Experts Group)
- Photographs.
- 16,777,216 colors. (Tad over 256.)
- Lossy compression (those are JPG horses).
- No transparency, animation, interlace, or patents.
- PNG (Portable Network Graphics)
- Replacement for GIF.
- Keep your 16,777,216 colors.
- No patents.
- Often larger than GIF.
- Not particularly well-supported.
- Linking with images.
- Simply place an image inside the <a> tag:

<a href="page.html"><img src="img.gif" /></a>
- Often like to use border="0".

<a href="page.html"><img src="img.gif" border="0" /></a>
- Image maps. [ Imagemap Example ]
- A picture where parts are links.
- Specify an image with <img>
- Specify the map with the usemap attribute.
- Specify a map with the <map> tag.
- The usemap gives a URL, which is almost always
internal (starts with #).
- The <map> contains a name or id (use both)
to match it to the <img>.
- Maps: <map> . . . <area> . . . </area> . . . </map>
- <map> attributes: id or name; use id.
- <area> attributes.
- href and alt: Same as <a>.
- shape: rect, circle, or poly.
- coords: List of coordinates according to shape.
- A string, giving values separated by commas.
- For rect: Coordinates of upper left and lower right,
four values.
- For circle: Coordinates of center and the radius,
three values.
- For poly: Coordinates of each corner, two values for each
point.
- Areas can be effectively combined by linking them to the same
place.
- The ismap attribute of <img>.
- Specifies a server-side map. A server-side map is processed by
the server, not the browser.
- Clicking the image sends the coordinates to the server, which
responds with an appropriate page.
- Original map; not so common now.
- Most image processing software tracks the location of the mouse.
This can let you build an image map.
- Using images well.
- Images should be as small as possible to save time.
- Reduce the dimensions.
- Using height and width sends the large image, and
the browser reduces it.
- More efficient to make a smaller image on the server.
- Most any image software.
- Reduce the number of colors.
- Increase the compression.
- Reuse images.
- Link the same image from many pages.
- Browsers cache.
- Copies in different places lose this advantage.
- Some [ interesting stretches ].
- Audio and video.
- Audio formats: MP3, real audio, wav, etc.
- Video formats: AVI, MPEG, QuickTime.
- Support in any particular browser will be uncertain.
- Can play sound by simply linking a file of that type.
train gong
Click <a href="noise.mp3">here</a> to play sound.
- The <embed> tag.
- Not, apparently, standard XHTML.
- <embed src="someurl.mp3" autostart="true">
- <embed src="someurl.mpeg" autostart="false" width="400" height="200">
- Resources
- The Gimp is a
free and fine image manipulation program.
- Inkscape is
another graphics editor. It can produce
SVG images which scale well.
- ImageMagick
is a set of command-line tools for
manipulating images. It is particularly useful for
automating image operations, or peforming a transformation on a
large batch of images.
- The Open Clip Art Library is
sort of a clip-art cooperative. They have much content stored in the
SVG format, which can be converted to more common formats using Gimp.