JPEG is a common image format for photographs and complex images. Its lossy compression makes files smaller, trading some image quality for faster downloads and less bandwidth use. section 6.13 section 6.17
Choose JPEG when the picture matters more than perfectly crisp, limited-color edges:
- Start JPEG compression around 60% to 75%, then inspect the result; more compression usually harms quality, while less compression produces larger files. section 6.13
- Resize images before uploading them. A browser can shrink an oversized file, but making it download a huge image first wastes bandwidth. section 6.13
- Prefer JPEG for photos and complex imagery; use PNG instead for illustrations, logos, icons, or transparency. section 6.17
A practical photo gallery
Prepare each photo as a regular image and a thumbnail. One workable gallery uses 300 × 200 pixel thumbnails and 2048 × 1365 full-size JPEGs, keeping the larger files within a sensible size. section 15.2
<img src="file" alt="description" title="tooltip">
Place a JPEG on a web page by using its filename as the img element’s source and providing descriptive alternative text. section 6.17
