# JPEG文件交换格式

JPEG文件交换格式（JPEG File Interchange Format，JFIF）是一种精简的文件格式，其设计目的是让JPEG位流能够在多种不同的平台和应用程序之间传输。它符合ISO/IEC 10918-1附录B中定义的JPEG交换格式，但额外使用了APP0标记段，并对帧头中的某些参数加以约束。<sup>[1](https://www.w3.org/Graphics/JPEG/jfif.pdf)</sup> 1992年发布的1.02版至今仍是现行修订版，也是大多数人提到“JPEG文件”时所指的格式。<sup>[2](https://www.loc.gov/preservation/digital/formats/fdd/fdd000018.shtml)</sup>

| 关键事实 | 详情 |
|---|---|
| 目的 | 作为跨平台交换JPEG压缩图像的最小容器；有意省略了TIFF<sup>[3](https://www.ecma-international.org/wp-content/uploads/ECMA_TR-98_1st_edition_june_2009.pdf)</sup>的标记头等高级特性 |
| 定义性结构 | 一个JPEG位流，其第二个段是携带以零结尾的标识符“JFIF”（字节X'4A 46 49 46 00'）的APP0标记<sup>[1](https://www.w3.org/Graphics/JPEG/jfif.pdf)</sup> |
| 当前版本 | 1.02，1992年发布；新增了缩略图格式，最重要的是JPEG压缩的缩略图<sup>[2](https://www.loc.gov/preservation/digital/formats/fdd/fdd000018.shtml)</sup><sup> • </sup><sup>[3](https://www.ecma-international.org/wp-content/uploads/ECMA_TR-98_1st_edition_june_2009.pdf)</sup> |
| 起源 | 由C-Cube微系统公司的埃里克·汉密尔顿（Eric Hamilton）牵头，于1991年末一次会议上制定，与会者约40人，来自计算机、电信和成像企业<sup>[3](https://www.ecma-international.org/wp-content/uploads/ECMA_TR-98_1st_edition_june_2009.pdf)</sup> |
| 正式标准化 | Ecma国际TR/98（2009年6月）；ITU-T建议书T.871（2011年5月）；ISO/IEC 10918-5:2013<sup>[3](https://www.ecma-international.org/wp-content/uploads/ECMA_TR-98_1st_edition_june_2009.pdf)</sup><sup> • </sup><sup>[2](https://www.loc.gov/preservation/digital/formats/fdd/fdd000018.shtml)</sup> |
| 采用情况 | 采用极为广泛，超过了原始JPEG位流和ISO/IEC 10918第3部分规定的SPIFF格式<sup>[2](https://www.loc.gov/preservation/digital/formats/fdd/fdd000018.shtml)</sup> |
| 注册标识符 | PRONOM PUID fmt/44（JFIF 1.02）<sup>[4](https://www.nationalarchives.gov.uk/pronom/fmt/44)</sup> |

## 目的与设计

JPEG压缩标准由ISO于1990年8月标准化，它定义了图像数据如何压缩，但并未规定可交换文件格式的所有细节，例如如何声明像素密度、宽高比或色彩空间。<sup>[5](https://www.w3.org/Graphics/JPEG/)</sup><sup> • </sup><sup>[6](https://fossies.org/linux/GDCM/Utilities/gdcmjpeg/Jfif.txt)</sup> JFIF以尽可能最小的结构填补了这些空白。它不含TIFF规范或特定应用格式中的任何高级特性；其明确目的仅是允许交换JPEG压缩图像。<sup>[3](https://www.ecma-international.org/wp-content/uploads/ECMA_TR-98_1st_edition_june_2009.pdf)</sup>

每个JFIF文件开头的APP0段携带了JPEG流本身所缺的元数据：版本号、X和Y像素密度及单位字段（每英寸点数、每厘米点数或仅宽高比），以及可选的嵌入缩略图尺寸。<sup>[6](https://fossies.org/linux/GDCM/Utilities/gdcmjpeg/Jfif.txt)</sup> 标识符字段是五字节的以零结尾的ASCII字符串“JFIF”，它唯一地标识这个APP0标记。<sup>[1](https://www.w3.org/Graphics/JPEG/jfif.pdf)</sup> 其后可以跟一个JFIF扩展APP0段，支持替代的缩略图编码，包括用JPEG本身压缩的缩略图。<sup>[1](https://www.w3.org/Graphics/JPEG/jfif.pdf)</sup>

尽管语法上支持任何JPEG过程，规范仍强烈建议交换时使用基线JPEG过程，以确保与支持JPEG的应用程序实现最大兼容性。<sup>[3](https://www.ecma-international.org/wp-content/uploads/ECMA_TR-98_1st_edition_june_2009.pdf)</sup>

## 历史

JFIF由一群计算机、电信和成像企业在1990年代初合作开发。埃里克·汉密尔顿代表[C-Cube微系统公司](https://www.edgepedia.org/zh/c-cube-microsystems)主导了开发工作，并于1991年末主办了一次会议，旨在创建一种基于JPEG的简单文件格式。<sup>[3](https://www.ecma-international.org/wp-content/uploads/ECMA_TR-98_1st_edition_june_2009.pdf)</sup> 1.0版仅短暂流传；1.01版被独立JPEG小组（Independent JPEG Group，IJG）用于其公有领域软件，最终导致数以百万计的图像以此格式发布。1992年晚些时候，用户反馈促成了最终的1.02版，该版新增了缩略图格式，最重要的是以压缩形式存储的缩略图。<sup>[3](https://www.ecma-international.org/wp-content/uploads/ECMA_TR-98_1st_edition_june_2009.pdf)</sup>

近二十年间，JFIF仅作为事实标准存在，自由流传、广泛实现，却从未正式发布。[Ecma国际](https://www.edgepedia.org/zh/ecma-international)于2009年6月解决了这一问题，将1.02规范作为技术报告TR/98重新发布，技术上与原始版本完全一致。<sup>[3](https://www.ecma-international.org/wp-content/uploads/ECMA_TR-98_1st_edition_june_2009.pdf)</sup> 2011年，ITU发布了基本相同的规范，即建议书T.871，并声明其制定主要是为了将JFIF 1.02规范正式化；2013年它成为ISO/IEC 10918-5:2013，其相同文本作为ITU-T建议书T.871发布。<sup>[2](https://www.loc.gov/preservation/digital/formats/fdd/fdd000018.shtml)</sup> 该ISO标准于2018年复审时获得确认，此后又再次确认，因此至今仍然现行。<sup>[7](https://www.iso.org/standard/54989.html)</sup>

## 与JPEG、JPG和Exif的关系

在日常使用中，JFIF和JPEG常被混为一谈，文件扩展名也反映了这一点：.jpg、.jpeg和.jpe只是命名偏好，并非不同格式。<sup>[8](https://github.com/nigeltao/nigeltao.github.io/blob/master/blog/2021/from-jpeg-to-jfif.md)</sup> 从技术上讲，JFIF文件是一种JPEG文件，其第二个块——在作为第一个块的SOI标记之后——是有效载荷以“JFIF”开头的APP0块。<sup>[8](https://github.com/nigeltao/nigeltao.github.io/blob/master/blog/2021/from-jpeg-to-jfif.md)</sup>

该格式与Exif共存，后者是JEIDA于1995年为数码相机发布的元数据标准。Exif文件则以携带标识符“Exif”的APP1段开头。<sup>[9](https://www.usenix.org/system/files/conference/usenixsecurity18/sec18-chapman.pdf)</sup> 由于JFIF标准要求APP0在前，以JFIF APP0头写入的文件通常不含Exif块；而在实践中，相机生成的大多数JPEG文件同时包含JFIF和Exif标记，JFIF在前，Exif作为后续段。<sup>[10](https://jfifconverter.net/jfif-vs-jpg/)</sup><sup> • </sup><sup>[8](https://github.com/nigeltao/nigeltao.github.io/blob/master/blog/2021/from-jpeg-to-jfif.md)</sup>

色彩管理是一个已知局限。JFIF的色彩空间支持比SPIFF更有限，不支持声明sRGB。不过，ICC配置文件可以作为应用数据段嵌入：ICC规范ICC.1:2004-10规定由APP2标记引入配置文件，其标签以零结尾的字节序列“ICC_PROFILE”开头。<sup>[2](https://www.loc.gov/preservation/digital/formats/fdd/fdd000018.shtml)</sup> [数字化](https://www.edgepedia.org/zh/digitization)指南据此将JPEG的色彩保持评为需要Exif或其他扩展来嵌入ICC配置文件。<sup>[11](https://www.digitizationguidelines.gov/guidelines/FADGI_RasterFormatCompare_p2_20140902_r.pdf)</sup>

## 实用说明

JFIF的极简主义对工具开发者有影响。其结构透明，但JPEG编码可能依赖算法和工具来读取，因此构建读取器需要一定的专业水平；自描述能力仅限于APP0中的技术元数据。<sup>[2](https://www.loc.gov/preservation/digital/formats/fdd/fdd000018.shtml)</sup> 该文件格式本身没有专利或许可限制。<sup>[2](https://www.loc.gov/preservation/digital/formats/fdd/fdd000018.shtml)</sup> 与其他容器格式一样，JPEG允许存在解码时不使用的段，这一点已被利用来在看似普通的图像文件中隐藏数据。<sup>[9](https://www.usenix.org/system/files/conference/usenixsecurity18/sec18-chapman.pdf)</sup>

## References

1. [JPEG File Interchange Format, Version 1.02 (1992 specification)](https://www.w3.org/Graphics/JPEG/jfif.pdf)
2. [JFIF, JPEG File Interchange Format, Version 1.02, Library of Congress Format Description fdd000018](https://www.loc.gov/preservation/digital/formats/fdd/fdd000018.shtml)
3. [Ecma International TR/98, JPEG File Interchange Format (JFIF), 1st edition, June 2009](https://www.ecma-international.org/wp-content/uploads/ECMA_TR-98_1st_edition_june_2009.pdf)
4. [PRONOM entry fmt/44, The National Archives (UK)](https://www.nationalarchives.gov.uk/pronom/fmt/44)
5. [JPEG JFIF, W3C](https://www.w3.org/Graphics/JPEG/)
6. [JFIF specification text as distributed in GDCM source](https://fossies.org/linux/GDCM/Utilities/gdcmjpeg/Jfif.txt)
7. [ISO/IEC 10918-5:2013, ISO](https://www.iso.org/standard/54989.html)
8. [From JPEG to JFIF, nigeltao.github.io](https://github.com/nigeltao/nigeltao.github.io/blob/master/blog/2021/from-jpeg-to-jfif.md)
9. [Chapman et al., USENIX Security 2018, on JPEG and PNG container structure](https://www.usenix.org/system/files/conference/usenixsecurity18/sec18-chapman.pdf)
10. [JFIF vs JPG: Are They the Same?](https://jfifconverter.net/jfif-vs-jpg/)
11. [Raster Still Images for Digitization: A Comparison of File Formats, FADGI](https://www.digitizationguidelines.gov/guidelines/FADGI_RasterFormatCompare_p2_20140902_r.pdf)

---
*Initially written Sep 17, 2026 · Reviewed: Oct 15, 2026 · Edited: Oct 15, 2026 · Last review: Oct 15, 2026*

Topic: 技术与人造世界 › 计算技术与数字系统 › 软件与编程 › Data formats and serialization › Image and video formats

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/jpeg-file-interchange-format

English original: https://www.edgepedia.org/jpeg-file-interchange-format
