Images and Image Maps

 

Course topics by week 
1. Intro to HTML 56. Page Layout with CSS
2. More on Creating Web Pages7. HTML Tables
3. Site Design + More on Hyperlinks8. HTML Forms
4. Design with CSS9. Multimedia
5. Midterm10. Term Project

Contents

Common Image Formats

BMP

The bitmap format is an uncompressed file format. This is not normally used on web pages because the files tend to be large. Bitmap files will have the extension .bmp.

GIF

The Graphic Interchange Format is used for uncompressed, animated images.

JPEG

Joint Photographic Experts Group is a lossy compression algorithm that is popular for compressing images to be used on the web because it can be used to make very small image files, but with loss of image quality. JPEG files will have the extensions .jpg, or .jpeg.

JPEG files may also be formatted using JFIF (Joint File Interchanging Format) and have the extensions .jfif or .jif.

PNG

Portable Network Graphics is a lossless compression algorithm that is also popular for images in web pages.

WebP

Web Picture is a newer type of compression algorithm that is becoming more popular for use on web pages. It offers better compression than JPEG or PNG, can be used for either lossless or lossy compression and for still or animated images.

 

Image Maps

Images can be divided into different zones, or hotspots, each linked to a different target destination.

To define hotspots, you create an image map that contains <area> elements that map specified regions of the image to specific web pages or locations.

 

Hotspot attributes

Computer graphics coordinate system

In two dimensional computer graphics, a cartesian coordinate system is used in which the x-axis starts at the left and extends to the right and the y-axis starts at the top and extends to the bottom.

2D computer graphics coordinate system

Image from Program Arcade Games with Python and PyGame

Finding coordinates in an image

You can use a photo editing program like Windows Paint, Gimp, or Photoshop (or Photoshop Elements) to find coordinates, or you can use an online service like the one shown in the reference section of these notes.

Rectangular hotspots

Two points define a rectangular hotspot: the upper-left corner the lower-right corner.

Circular hotspots

A circular hotspot is defined by the location of its center and its radius.

Polygonal hotspots

To create a polygonal hotspot, you enter the coordinates for each vertex in the shape.

 

Default hotspot

 

Reference

Image file type and format guideMDN article

JPEG 101: A Crash Course on JPEGWebFX article

HTML TagW3Schools tutorial

Online service for getting mouse-click image coordinatesMobilefish.com

 


Creative Commons License Web Authoring Lecture Notes by Brian Bird, 2017, revised 2022, are licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.