JPEG Image Coding
JPEG dominates photo storage and delivery. EXIF metadata (GPS, camera, orientation) lives in APP1 markers โ relevant for privacy, image processing, and upload pipelines.
What It Defines
Lossy DCT-based raster image format. Begins with magic bytes `FF D8 FF`, followed by marker segments (SOI, APPn/EXIF, DQT, SOF, SOS, EOI). JFIF and Exif are common container conventions layered on JPEG markers. MIME type: `image/jpeg`.
Canonical (Normative)
Convenient (Practical)
Related References
Joint ISO/IEC technical committee (JTC 1) publishes many of the binary file formats the web depends on: JPEG, PDF, MP4/ISOBMFF, ZIP (ISO/IEC 21320), and office document containers. Specs are often available via national body mirrors; some are freely readable online.
Related Specs
Every upload, download, attachment, and asset pipeline crosses these layers. Misunderstanding header vs envelope causes MIME spoofing bugs, parser differentials, and broken file validation. Start here before diving into individual format specs.
Extension spoofing (`virus.exe` โ `photo.jpg`) and MIME spoofing are common attack vectors. Magic-byte detection is the first line of defense in upload validation, antivirus, and content sniffing.
Correct Content-Type headers drive content negotiation, browser rendering, and API behavior. Wrong types cause security and parsing bugs.
PNG is the default lossless image format on the web โ screenshots, UI assets, icons with transparency, and OCR-friendly graphics. Chunk structure matters for metadata stripping and security review.
WebP delivers smaller files than JPEG/PNG for equivalent quality โ widely used for web delivery via `<picture>`, CDN transforms, and Next.js image optimization.
AVIF is the next-generation web image format โ `<picture>` fallbacks, CDN support, and browser adoption make it worth knowing for asset pipelines and performance work.