Joint Photographic Experts Group (.jpg)
ISO/IEC 标准JPEG is the most widely adopted lossy compression standard for digital photography and web imagery, exploiting the human eye's higher sensitivity to luminance over chrominance.
将 PNG 转换为 JPG
免费的浏览器端 PNG 转 JPG 转换器。在您的设备上即时转换文件。
在线压缩 JPG
100% 浏览器本地私密压缩 — 文件永不离开您的设备
检查与元数据
操作系统和文件分析器通过检查开头的二进制字节序列来识别 JPG 文件:
字节级文件头签名 (Magic Bytes)
操作系统和文件分析器通过检查开头的二进制字节序列来识别 JPG 文件:
十六进制签名 (偏移量 0):
FF D8 FFASCII 表示形式: ÿØÿ
标准化: ISO/IEC 10918-1 / ITU-T T.81
技术规格
| 容器架构 | Marker-delimited binary stream (0xFF prefix) wrapped in JFIF or EXIF headers |
| 压缩方式 | Lossy Discrete Cosine Transform (DCT) + Run-length & Huffman entropy coding |
| 字节序 | Big-Endian for marker lengths and quantization tables; Exif can be Little (II) or Big (MM) |
| 色彩空间 | sRGB, Adobe RGB, CMYK, Y'CbCr, Grayscale |
| 通道与结构 | 8-bit per channel (24-bit Truecolor) or 8-bit Grayscale |
| 最大尺寸 | 65,535 x 65,535 pixels (2-byte unsigned integers) |
| 透明度 | None (Opaque only; no alpha channel support) |
| 流式传输与渐进式加载 | Progressive JPEG encoding stores multiple spectral passes from low to high resolution |
技术对比矩阵:JPG 对比同类产品
| 技术属性 | JPG (当前) | WebP | AVIF | PNG |
|---|---|---|---|---|
| Compression Paradigm | Lossy DCT + Huffman coding | Lossy (VP8) & Lossless | Lossy (AV1) & Lossless | Lossless Deflate |
| Alpha Transparency | No alpha channel support (always opaque) | 8-bit alpha transparency | 8-bit / 10-bit / 12-bit alpha | Full 8-bit / 16-bit alpha |
| Hardware Decoding | 100% dedicated silicon in virtually every GPU and mobile SoC | Widespread hardware decode in modern SoCs | Rapidly expanding hardware decode in modern GPUs | CPU-based fast decode |
| Compression Efficiency | Good baseline for photographs | 25%-35% smaller than JPEG at equal quality | 40%-55% smaller than JPEG at equal quality | Inefficient for photographic content |
| Color Bit Depth | Standard 8-bit per channel (24-bit Truecolor) | 8-bit per channel | 10-bit & 12-bit HDR wide color gamut | 8-bit & 16-bit per channel |
常见损坏模式与十六进制恢复指南
⚠️ Image viewer shows 'Premature end of JPEG file' or the lower portion of the photo is solid gray or colorful banding.
根本原因: Truncated download or incomplete storage write missing the 0xFFD9 (EOI) trailer marker and image scan payload.
恢复方法: Append marker 0xFFD9 to the end of the truncated stream to allow decoders to display the intact upper portion of the photograph.
⚠️ Image colors appear heavily shifted, inverted, or psychedelic.
根本原因: CMYK color space header inverted or invalid embedded ICC profile.
恢复方法: Convert the color space from CMYK to sRGB using ImageMagick ('magick broken.jpg -colorspace sRGB fixed.jpg').
⚠️ File fails to open and reports 'Invalid marker found'.
根本原因: Bit corruption inside the Quantization Table (DQT 0xFFDB) or Huffman Table (DHT 0xFFC4) headers.
恢复方法: Replace the damaged header markers with standard baseline JFIF Huffman and Quantization tables extracted from an intact JPEG.
安全分析与解析器攻击向量
JPEG security primarily involves metadata privacy leaks (EXIF) and buffer overflows in legacy C decoders (libjpeg).
已知攻击向量
- Sensitive metadata disclosure: Unstripped EXIF headers containing GPS coordinates, camera serial numbers, and thumbnail previews.
- Buffer over-reads and integer overflows in legacy libjpeg parsing corrupt restart markers (RST) or progressive scan scripts.
- Polyglot files combining JPEG headers with executable ZIP or RAR archives.
防御性最佳实践: Always strip EXIF and GPS geolocation metadata when publishing user photos to protect user privacy. Use modern memory-safe decoders (such as image-rs in Rust) or sandboxed WebAssembly decoders.
历史渊源与里程碑
核心优势与特点
- 100% universal hardware and software decoding support across all computers and cameras.
- Excellent compression ratios (10:1 to 20:1) for photographic continuous tones.
- Small payload footprint with progressive rendering capability.
技术局限与劣势
- Lossy compression causes compression artifacts (ringing and blockiness) along sharp edges.
- No transparency channel support.
- Generation loss occurs every time a file is decompressed, edited, and re-saved.
趣味技术冷知识
- The classic 'Lenna' test image used to develop JPEG compression was scanned from the November 1972 issue of Playboy magazine.
- JPEG 4:2:0 subsampling halves chroma resolution both horizontally and vertically with near-zero perceptual degradation.
- Every standard JPEG begins with marker 0xFFD8 (Start of Image) and ends with 0xFFD9 (End of Image).
常见技术问题
Why does saving a JPEG file multiple times reduce image quality?
JPEG is an irreversibly lossy compression format. Each time you decompress and re-save a JPEG, the DCT quantization step discards high-frequency spatial details and re-approximates 8x8 pixel blocks, causing cumulative 'generation loss' artifacts.
What is Progressive JPEG and why is it useful?
A standard baseline JPEG decodes scanline by scanline from top to bottom. Progressive JPEG encodes image data in multiple spectral passes, allowing browsers to render a low-resolution blur of the entire image instantly and sharpen it progressively as bytes download.
What is Chroma Subsampling (4:2:0 vs 4:4:4)?
The human retina has more rod cells (luminance/brightness) than cone cells (color). JPEG exploits this by preserving full brightness resolution (Y) while halving color resolution (Cb, Cr) horizontally and vertically (4:2:0), shedding 50% of the raw data before compression with imperceptible loss.
Can a JPEG image have a transparent background?
No. The standard JPEG specification has no concept of an alpha channel. If transparency is required, you must convert the image to WebP, AVIF, or PNG.
相关的 JPG 转换对
Convert lossless PNG images with solid backgrounds into lightweight, high-compatibility JPEG photos.
Convert compressed JPEG images into lossless PNG format for clean editing and transparency support.
Convert JPEG photos into modern WebP format to reduce web payload size by 25-35%.
Convert WebP images into universal JPEG format for legacy applications and older device compatibility.
Convert Apple iOS HEIC photos into standard JPEG files for sharing across Windows and Android devices.
Convert JPEG photos into High Efficiency HEIC format for compact storage on Apple devices.
Convert next-generation AVIF images into universally compatible JPEG photos.
Compress JPEG photos into cutting-edge AVIF format for maximum web compression efficiency.