Sub topic 1
Pixels, Resolution, and Screen Density
Prerequisites
You should know how to use layers, frames, and export panels in a design tool. You should also understand that HTML and CSS control how an image appears on a web page.
Pixels and Screen Density
A pixel is one tiny unit of color in a raster image. Image dimensions describe the number of pixels across and down. A 1200 × 800 image contains 960,000 pixels.
Resolution describes how much detail an image can contain. For web work, pixel dimensions matter more than print measurements such as dots per inch. Screen density describes how many physical display pixels represent one CSS pixel. A high-density screen may use two physical pixels for each CSS pixel. Exporting a 200-pixel image at 2x creates a 400-pixel file that can look sharp when displayed at 200 CSS pixels.
Raster Versus Vector Images
A raster image stores a fixed grid of pixels. Photographs and textured artwork are raster images. Enlarging them beyond their intended size can make them blurry or blocky.
A vector image stores shapes, paths, and mathematical relationships. Logos, icons, and simple illustrations can scale to any size without losing edge sharpness. SVG is the main vector format used on the web.
Lossy Versus Lossless Compression
Compression reduces file size. Lossy compression removes visual information permanently. It usually produces smaller files, but too much compression creates blocky edges, color bands, or smeared details.
Lossless compression preserves the original image data. The file remains exactly recoverable, although it may be larger. Use it when every pixel matters, especially for sharp interface graphics or transparency.
| Image type | Usual starting format | Main reason |
|---|---|---|
| Photograph | JPEG | Efficient lossy compression |
| Flat graphic with transparency | PNG | Sharp edges and lossless storage |
JPEG: Photographs and Complex Images
JPEG works well for photographs, gradients, and complex images without transparency. Choose a quality setting by comparing the preview with the file size. A quality of 70 may be sufficient, but the correct value depends on the image.
PNG: Sharp Edges, Flat Color, and Transparency
PNG preserves sharp boundaries and supports transparency. Use it for interface screenshots, diagrams, or graphics with a transparent background. Do not automatically use PNG for photographs, because the resulting file is often much larger than a visually similar JPEG.
Exercise
A photographic hero image appears at 800 CSS pixels wide on a high-density screen. What raster width should you export first?
Show answer
Export a 1600-pixel-wide version, then compare its visual quality and file size with the page budget.