PNG and MNG tools |
Copyright 2000, Glenn Randers-Pehrson, randeg@alum.rpi.edu, all rights reserved.
You may link to this file or (preferably) to the directory in which it resides, but please do not copy this file to your web site. If and when this document emerges from draft status, it will be released on more generous terms, identical to those of the PNG extensions document [PNGEXT].
This is a draft of a proposal to the PNG Development Group for registration of a new text keyword (EXIF) or a new special-purpose chunk (eXIf or eXIF). It has not been approved by any approving body.
This document and the latest version of this document can be found at <http://pmt.sourceforge.net/exif>. If at some date the files move to another site, I intend to leave a link to the new location here, if possible.
This document proposes a new PNG [PNG] registered keyword, "EXIF", and may propose a new PNG special-purpose chunk, "eXIf" or "eXIF" or both. It shows how to preserve the EXIF information [EXIFFORMAT] that is present in a TIFF-EP [TIFF-EP] file, when converting the file to PNG or JNG [JNG] format (JNG is a sub-format of the MNG (Multiple-image Network Graphics) [MNG] format.
Tags that provide details about the TIFF compression itself are no longer useful and are dropped. Other tags can be converted to existing PNG chunks, or to a tEXt/zTXt/iTXt chunk using the "EXIF" keyword, as shown in this table.
TIFF Tag | EXIF Item Name | PNG encoding |
---|---|---|
0x100 | ImageWidth | [1] IHDR width, text EXIF width |
0x101 | ImageLength | IHDR height, text EXIF height |
0x102 | BitsPerSample | [2] sBIT |
0x103 | Compression | [3] text EXIF Compression |
0x106 | PhotometricInterpretation | text EXIF Photo... |
0x10A | FillOrder | [4] drop? |
0x10D | DocumentName | text Title |
0x10E | ImageDescription | text Description |
0x10F | Make | text EXIF Make |
0x110 | Model | text EXIF Model |
0x111 | StripOffsets | drop |
0x112 | Orientation | [5] text EXIF Orientation |
0x115 | SamplesPerPixel | drop |
0x116 | RowsPerStrip | drop |
0x117 | StripByteCounts | drop |
0x11A | XResolution | pHYs X/unit |
0x11B | YResolution | pHYs Y/unit |
0x11C | PlanarConfiguration | text EXIF Planar.. |
0x128 | ResolutionUnit | pHYs unit |
0x12D | TransferFunction | [6] text EXIF TransferFunction |
0x131 | Software | text EXIF Software |
0x132 | DateTime | [7] tIME/text Creation time |
0x13B | Artist | text Author |
0x13E | WhitePoint | cHRM |
0x13F | PrimaryChromaticities | cHRM |
0x156 | TransferRange | text EXIF Transfer.. |
0x200 | JPEGProc | [8] drop? |
0x201 | JPEGInterchangeFormat | drop? |
0x202 | JPEGInterchangeFormatLength | drop? |
0x211 | YCbCrCoefficients | [9] drop |
0x212 | YCbCrSubSampling | drop |
0x213 | YCbCrPositioning | drop |
0x214 | ReferenceBlackWhite | text EXIF referenceB... ? |
0x828D | CFARepeatPatternDim | ? |
0x828E | CFAPattern | ? |
0x828F | BatteryLevel | text EXIF Battery... |
0x8298 | Copyright | text Copyright |
0x829A | ExposureTime | text EXIF ExposureTime |
0x829D | FNumber | text EXIF FNumber |
0x83BB | IPTC/NAA | text EXIF IPTC/NAA ? |
0x8769 | ExifOffset | oFFs ? |
0x8773 | InterColorProfile | [10] iCCP |
0x8822 | ExposureProgram | text EXIF ExposureP.. |
0x8824 | SpectralSensitivity | text EXIF Spectral... |
0x8825 | GPSInfo | text EXIF GPSInfo |
0x8827 | ISOSpeedRatings | text EXIF ISOSpeed.. |
0x8828 | OECF | text EXIF OECF |
0x9000 | ExifVersion | text EXIF ExifVersion |
0x9003 | DateTimeOriginal | [11] text EXIF DateTimeO... |
0x9004 | DateTimeDigitized | [12] text EXIF DateTimeD... |
0x9101 | ComponentsConfiguration | text EXIF Compon... |
0x9102 | CompressedBitsPerPixel | text EXIF Compre... |
0x9201 | ShutterSpeedValue | text EXIF Shutter.. |
0x9202 | ApertureValue | text EXIF Aperture.. |
0x9203 | BrightnessValue | text EXIF Brightness.. |
0x9204 | ExposureBiasValue | text EXIF ExposureB.. |
0x9205 | MaxApertureValue | text EXIF MaxApert.. |
0x9206 | SubjectDistance | text EXIF SubjectDist.. |
0x9207 | MeteringMode | text EXIF MeteringMode |
0x9208 | LightSource | text EXIF Lightsource |
0x9209 | Flash | text EXIF Flash |
0x920A | FocalLength | [13] text EXIF FocalLength |
0x920B | FlashEnergy | text EXIF FlashEnergy |
0x920C | SpatialFrequencyResponse | text EXIF SpatialF... |
0x020E | FocalPlaneXResolution | text EXIF FocalPlaneX... |
0x920F | FocalPlaneYResolution | text EXIF FocalPlaneY... |
0x9210 | FocalPlaneResolutionUnit | text EXIF FocalPlaneR... |
0x9214 | SubjectLocation | text EXIF SubjectLocation |
0x9215 | ExposureIndex | text EXIF ExposureIndex |
0x9217 | SensingMethod | text EXIF SensingMethod |
0x927C | MakerNote | text EXIF MakerNote |
0x9286 | UserComment | text Comment/text EXIF User.. |
0x9290 | SubSecTime | text EXIF SubSecTime |
0x9291 | SubSecTimeOriginal | text EXIF SubSecTimeO.. |
0x9292 | SubSecTimeDigitized | text EXIF SubSecTimeDigitized |
0xA000 | FlashPixVersion | text EXIF FlashPixVersion |
0xA001 | ColorSpace | text EXIF ColorSpace |
0xA002 | ExifImageWidth | text EXIF ExifImageWidth |
0xA003 | ExifImageLength | text EXIF ExifImageLength |
0xA005 | InteroperabilityOffset | text EXIF Inter... |
0xA20B | FlashEnergy | [14] text EXIF FlashEnergy |
0xA20C | SpatialFrequencyResponse | text EXIF SpatialFreq... |
0xA20E | FocalPlaneXResolution | text EXIF FocalPlaneX.. |
0xA20F | FocalPlaneYResolution | text EXIF FocalPlaneY.. |
0xA210 | FocalPlaneResolutionUnit | text EXIF FocalPlaneR.. |
0xA214 | SubjectLocation | text EXIF SubjectLocation |
0xA215 | ExposureIndex | text EXIF ExposureIndex |
0xA217 | SensingMethod | text EXIF SensingMethod |
0xA300 | FileSource | text EXIF FileSource |
0xA301 | SceneType | text EXIF SceneType |
[1] If the file is later cropped, don't change the text EXIF width and
height; they record the original width and height.
[2] The sBIT chunk is unnecessary and should not be written if the original file and the PNG file to which it is being converted have the same sample depth. [3] This identifies the compression method used in the original file. [4] Details about the original compression are of no further use and should be dropped. If an application converts the PNG file back to a TIFF-EP or ELIF file, it must supply these details with respect to the new file that it is creating. [5] This identifies the orientation of the original file. Converters should orient the pixels in the PNG or JNG file with the first pixel representing the top left corner of the image, using a lossless method of rotation. An application that converts a PNG or JNG back to TIFF-EP format should restore the image to its original orientation, using a lossless method of rotation. This is mandatory if the PNG image width and height have been swapped with respect to the recorded EXIF image height and width, and such reorientation must not be done if that would result in the image width and height being swapped with the recorded EXIF height and width (it is not possible to determine in this manner whether the EXIF-to-PNG converter actually performed a 180-degree rotation, when the orientation tag says the image was originally upside-down; the safest assumption is probably that the rotation was indeed accomplished). [6] Is this related to gamma? If so, a gAMA chunk should be written. It is recorded in EV units, so it isn't directly gamma. [7] This is the time the image was originally recorded by the camera. But see also [12]; how do these tags differ? [8], [9] This information is recorded in the JPEG datastream. [10] If the ICC profile is the sRGB profile, then write an sRGB chunk instead of an iCCP chunk (note that DCF images are always in sRGB). [11] A tIME chunk can also be written, containing the time that the image was first converted to the PNG or JNG format. If the image is later modified, the tIME chunk will be overwritten with the modification time. [12] A text "Creation time" chunk can also be written with this time. [13], [14] TIFF tags 0x920B through 0x9217 are duplicates of 0xA20B through 0xA217. The latter appear in the ISO Standard for TIFF-EP [TIFF-EP], but the former have been written by some applications. The tag list was obtained from the exifdump source code [EXIFDUMP], and compared with the tag list in the TIFF-EP Standard [TIFF-EP]. See also the "Description of the Exif file format" [EXIFFORMAT], which was generated by inspection of EXIF files, without reference to the actual EXIF specification [EXIFSPEC]. |
All of the EXIF information should be written in a single text EXIF chunk (multiple chunks can be used, provided that no particular tag appears in more than one of them), with a newline terminating the data for each item. In TIFF-EP tags whose data is a string ending with a null, the terminating null is replaced with a newline character, and embedded newlines are permitted. Any CRLF sequences in such strings are replaced with the newline character. If any character outside the Latin-1 character set is present (which would violate the TIFF-EP Standard but might happen anyway), the strings must be converted to UTF-8 format and the iTXt chunk must be used. The data field of the text chunk must begin with the EXIF keyword plus a caution not to edit the data manually:
EXIF\0Caution: Do not manually edit the data in this chunk.\n
Software applications for converting to and from the PNG format are beyond the scope of this document. It is clearly evident that Thierry Bousch's exifdump [EXIFDUMP] software could be easily modified to do the job.
[EXIFDUMP]
Bousch, Thierry, exifdump.py, v 1.13 (Python source
code for exifdump), 1999/08/21, available at
http://topo.math.u-psud.fr/~bousch/exifdump.py
[EXIFFORMAT]
Tachibanaya, TsuruZoh, "Description of Exif File Format",
Revision 1.2, July 19, 2000, available at
http://www.butaman.ne.jp/~tsuruzoh/Computer/Digicams/exif.html (Japanese)
http://www.butaman.ne.jp/~tsuruzoh/Computer/Digicams/exif-e.html (English)
[EXIFSPEC] I have not seen the formal specification of the EXIF format. It is not available on-line.
[JNG]
Randers-Pehrson, Glenn, et. al., "JNG (JPEG Network Graphics)
Specification, version 0.97, February, 2000, available at
ftp://swrinde.nde.swri.edu/pub/mng/documents.
[MNG]
Randers-Pehrson, Glenn, et. al., "MNG (Multiple-image Network
Graphics) Format, version 0.97", February, 2000, available at
ftp://swrinde.nde.swri.edu/pub/mng/documents.
[MNG-VLC]
Randers-Pehrson, Glenn, et. al., "MNG-VLC (Multiple-image Network
Graphics--Very Low Complexity) Format, version 0.97", February, 2000,
available at
ftp://swrinde.nde.swri.edu/pub/mng/documents.
[PNG]
Randers-Pehrson, Glenn, et. al., "PNG (Portable Network Graphics)
Specification, version 1.2", July, 1999, available at
ftp://swrinde.nde.swri.edu/pub/png/documents.
[PNGEXT]
Randers-Pehrson, Glenn, et. al., "Extensions to the PNG 1.2
Specification, version 1.2.0", July, 1999, available at
ftp://swrinde.nde.swri.edu/pub/png/documents.
[TIFF-EP]
ISO/DIS 12234-2, "Photography---Electronic still picture imaging---
Removable memory---Part 2: Image data format---TIFF-EP", November 24, 1998,
available at
http://www.pima.net/standards/iso/standards/documents/N4378.pdf