Grammar for JPEG files Total field byte count, including the byte count value (2 bytes), but excluding the marker itself start-of-image marker baseline DCT process frame marker SOF0: Baseline DCT SOF1: Extended sequential DCT, Huffman coding SOF2: Progressive DCT, Huffman coding SOF3: Lossless (sequential), Huffman coding SOF9: Extended sequential DCT, arithmetic coding SOF10: Progressive DCT, arithmetic coding SOF11: Lossless (sequential), arithmetic coding Sample precision – Specifies the precision in bits for the samples of the components in the frame. Number of lines – Specifies the maximum number of lines in the source image. This shall be equal to the number of lines in the component with the maximum number of vertical samples (see A.1.1). Value 0 indicates that the number of lines shall be defined by the DNL marker and parameters at the end of the first scan Number of samples per line – Specifies the maximum number of samples per line in the source image. This shall be equal to the number of samples per line in the component with the maximum number of horizontal samples Number of image components in frame – Specifies the number of source image components in the frame. The value of Nf shall be equal to the number of sets of frame component specification parameters (Ci, Hi, Vi, and Tqi) present in the frame header Component identifier – Assigns a unique label to the ith component in the sequence of frame component specification parameters. These values shall be used in the scan headers to identify the components in the scan. The value of Ci shall be different from the values of C1 through Ci − 1 Horizontal sampling factor – Specifies the relationship between the component horizontal dimension and maximum image dimension X (see A.1.1); also specifies the number of horizontal data units of component Ci in each MCU, when more than one component is encoded in a scan Vertical sampling factor – Specifies the relationship between the component vertical dimension and maximum image dimension Y (see A.1.1); also specifies the number of vertical data units of component Ci in each MCU, when more than one component is encoded in a scan Quantization table destination selector – Specifies one of four possible quantization table destinations from which the quantization table to use for dequantization of DCT coefficients of component Ci is retrieved. If the decoding process uses the dequantization procedure, this table shall have been installed in this destination by the time the decoder is ready to decode the scan(s) containing component Ci. The destination shall not be re- specified, or its contents changed, until all scans containing Ci have been completed start-of-scan marker Scan header length – Specifies the length of the scan header Number of image components in scan – Specifies the number of source image components in the scan. The value of Ns shall be equal to the number of sets of scan component specification parameters (Csj, Tdj, and Taj) present in the scan header Scan component selector – Selects which of the Nf image components specified in the frame parameters shall be the jth component in the scan. Each Csj shall match one of the Ci values specified in the frame header, and the ordering in the scan header shall follow the ordering in the frame header. DC entropy coding table destination selector – Specifies one of four possible DC entropy coding table destinations from which the entropy table needed for decoding of the DC coefficients of component Csj is retrieved. The DC entropy table shall have been installed in this destination (see B.2.4.2 and B.2.4.3) by the time the decoder is ready to decode the current scan. This parameter specifies the entropy coding table destination for the lossless processes AC entropy coding table destination selector – Specifies one of four possible AC entropy coding table destinations from which the entropy table needed for decoding of the AC coefficients of component Csj is retrieved. The AC entropy table selected shall have been installed in this destination (see B.2.4.2 and B.2.4.3) by the time the decoder is ready to decode the current scan. This parameter is zero for the lossless processes Start of spectral or predictor selection – In the DCT modes of operation, this parameter specifies the first DCT coefficient in each block in zig-zag order which shall be coded in the scan. This parameter shall be set to zero for the sequential DCT processes. In the lossless mode of operations this parameter is used to select the predictor. End of spectral selection – Specifies the last DCT coefficient in each block in zig-zag order which shall be coded in the scan. This parameter shall be set to 63 for the sequential DCT processes. In the lossless mode of operations this parameter has no meaning. It shall be set to zero Successive approximation bit position high – This parameter specifies the point transform used in the preceding scan (i.e. successive approximation bit position low in the preceding scan) for the band of coefficients specified by Ss and Se. This parameter shall be set to zero for the first scan of each band of coefficients. In the lossless mode of operations this parameter has no meaning. It shall be set to zero. Successive approximation bit position low or point transform – In the DCT modes of operation this parameter specifies the point transform, i.e. bit position low, used before coding the band of coefficients specified by Ss and Se. This parameter shall be set to zero for the sequential DCT processes. In the lossless mode of operations, this parameter specifies the point transform, Pt Define arithmetic coding conditioning Define hierarchical progression Define Huffman table(s) Table class – 0 = DC table or lossless table, 1 = AC table Huffman table destination identifier – Specifies one of four possible destinations at the decoder into which the Huffman table shall be installed Number of Huffman codes of length i – Specifies the number of Huffman codes for each of the 16 possible lengths allowed by this Specification. Li’s are the elements of the list BITS Value associated with each Huffman code – Specifies, for each i, the value associated with each Huffman code of length i. The meaning of each value is determined by the Huffman coding model. The Vi,j’s are the elements of the list HUFFVAL Define number of lines Restart interval – Specifies the number of MCU in the restart interval define-quantization-tables marker Expand reference component = X'4A', X'46', X'49', X'46', X'00' This zero terminated string (“JFIF”) uniquely identifies this APP0 marker. This string shall have zero parity (bit 7=0). Units for the X and Y densities Horizontal pixel density Vertical pixel density Thumbnail horizontal pixel count Thumbnail vertical pixel count Photoshop uses the JPEG APP12 "Ducky" segment to store some information in "Save for Web" images = X'4A', X'46', X'49', X'46', X'00' This zero terminated string (“JFIF”) uniquely identifies this APP0 marker. This string shall have zero parity (bit 7=0). Quantization table element precision – Specifies the precision of the Qk values. Value 0 indicates 8-bit Qk values; value 1 indicates 16-bit Qk values. Pq shall be zero for 8 bit sample precision P Quantization table destination identifier – Specifies one of four possible destinations at the decoder into which the quantization table shall be installed. Quantization table element – Specifies the kth element out of 64 elements, where k is the index in the zig- zag ordering of the DCT coefficients. The quantization elements shall be specified in zig-zag scan order. Quantization table element precision – Specifies the precision of the Qk values. Value 0 indicates 8-bit Qk values; value 1 indicates 16-bit Qk values. Pq shall be zero for 8 bit sample precision P Quantization table element – Specifies the kth element out of 64 elements, where k is the index in the zig- zag ordering of the DCT coefficients. The quantization elements shall be specified in zig-zag scan order. Obsolete--Photoshop 2.0 only Macintosh print manager print info record (Obsolete--Photoshop 2.0 only ) Indexed color table ResolutionInfo structure. See Appendix A in Photoshop API Guide.pdf Names of the alpha channels as a series of Pascal strings (Obsolete) See ID 1077DisplayInfo structure. See Appendix A in Photoshop API Guide.pdf The caption as a Pascal string Border information. Contains a fixed number (2 bytes real, 2 bytes fraction) for the border width, and 2 bytes for border units (1 = inches, 2 = cm, 3 = points, 4 = picas, 5 = columns) Background color Print flags. A series of one-byte boolean values (see Page Setup dialog): labels, crop marks, color bars, registration marks, negative, flip, interpolate, caption, print flags Grayscale and multichannel halftoning information Color halftoning information Duotone halftoning information Grayscale and multichannel transfer function Grayscale and multichannel transfer function Color transfer functions Duotone transfer functions Duotone image information Two bytes for the effective black and white values for the dot range (Obsolete) EPS options Quick Mask information. 2 bytes containing Quick Mask channel ID; 1- byte boolean indicating whether the mask was initially empty (Obsolete) Layer state information. 2 bytes containing the index of target layer (0 = bottom layer) Working path (not saved) Layers group information. 2 bytes per layer containing a group ID for the dragging groups. Layers in a group have the same group ID (Obsolete) IPTC-NAA record. Contains the File Info... information. See the documentation in the IPTC folder of the Documentation folder Image mode for raw format files JPEG quality. Private (Photoshop 4.0) Grid and guides information Future implementation of document-specific grids. Currently, sets the grid cycle to every quarter inch, i.e. 576 for both horizontal & vertical (at 72 dpi, that is 18 * 32 = 576) Future implementation of document-specific grids. Currently, sets the grid cycle to every quarter inch, i.e. 576 for both horizontal & vertical (at 72 dpi, that is 18 * 32 = 576) Number of guide resource blocks (can be 0) (Photoshop 4.0) Thumbnail resource for Photoshop 4.0 only (Photoshop 4.0) Copyright flag. Boolean indicating whether image is copyrighted. Can be set via Property suite or by user in File Info... (Photoshop 4.0) URL. Handle of a text string with uniform resource locator. Can be set via Property suite or by user in File Info... (Photoshop 5.0) Thumbnail resource (supersedes resource 1033) (Photoshop 5.0) Global Angle. 4 bytes that contain an integer between 0 and 359, which is the global lighting angle for effects layer. If not present, assumed to be 30 Obsolete) See ID 1073 below. (Photoshop 5.0) Color samplers resource (Photoshop 5.0) ICC Profile. The raw bytes of an ICC (International Color Consortium) format profile. See ICC1v42_2006-05.pdf in the Documentation folder and icProfileHeader.h in Sample Code\Common\Includes (Photoshop 5.0) Watermark. One byte (Photoshop 5.0) ICC Untagged Profile. 1 byte that disables any assumed profile handling when opening the file. 1 = intentionally untagged (Photoshop 5.0) Effects visible. 1-byte global flag to show/hide all the effects layer. Only present when they are hidden (Photoshop 5.0) Spot Halftone. 4 bytes for version, 4 bytes for length, and the variable length data (Photoshop 5.0) Document-specific IDs seed number. 4 bytes: Base value, starting at which layer IDs will be generated (or a greater value if existing IDs already exceed it). Its purpose is to avoid the case where we add layers, flatten, save, open, and then add more layers that end up with the same IDs as the first set (Photoshop 5.0) Unicode Alpha Names. Unicode string (Photoshop 6.0) Indexed Color Table Count. 2 bytes for the number of colors in table that are actually defined (Photoshop 6.0) Transparency Index. 2 bytes for the index of transparent color, if any (Photoshop 6.0) Global Altitude. 4 byte entry for altitude (Photoshop 6.0) Slices (Photoshop 6.0) Workflow URL. Unicode string (Photoshop 6.0) Jump To XPEP. 2 bytes major version, 2 bytes minor version, 4 bytes count. Following is repeated for count: 4 bytes block size, 4 bytes key, if key = 'jtDd' , then next is a Boolean for the dirty flag; otherwise it's a 4 byte entry for the mod date (Photoshop 6.0) Alpha Identifiers. 4 bytes of length, followed by 4 bytes each for every alpha identifier (Photoshop 6.0) URL List. 4 byte count of URLs, followed by 4 byte long, 4 byte ID, and Unicode string for each count Photoshop 6.0) Version Info. 4 bytes version, 1 byte hasRealMergedData , Unicode string: writer name, Unicode string: reader name, 4 bytes file version (Photoshop 7.0) EXIF data 1 (Photoshop 7.0) EXIF data 3 (Photoshop 7.0) XMP metadata. File info as XML description (Photoshop 7.0) Caption digest. 16 bytes: RSA Data Security, MD5 message-digest algorithm Photoshop 7.0) Print scale. 2 bytes style (0 = centered, 1 = size to fit, 2 = user defined). 4 bytes x location (floating point). 4 bytes y location (floating point). 4 bytes scale (floating point) (Photoshop CS) Pixel Aspect Ratio. 4 bytes (version = 1 or 2), 8 bytes double, x / y of a pixel. Version 2, attempting to correct values for NTSC and PAL, previously off by a factor of approx. 5% (Photoshop CS) Layer Comps. 4 bytes (descriptor version = 16), Descriptor (Photoshop CS) Alternate Duotone Colors. 2 bytes (version = 1), 2 bytes count, following is repeated for each count: [ Color: 2 bytes for space followed by 4 * 2 byte color component ], following this is another 2 byte count, usually 256, followed by Lab colors one byte each for L, a, b. This resource is not read or used by Photoshop (Photoshop CS)Alternate Spot Colors. 2 bytes (version = 1), 2 bytes channel count, following is repeated for each count: 4 bytes channel ID, Color: 2 bytes for space followed by 4 * 2 byte color component. This resource is not read or used by Photoshop (Photoshop CS2) Layer Selection ID(s). 2 bytes count, following is repeated for each count: 4 bytes layer ID (Photoshop CS2) HDR Toning information (Photoshop CS2) Print info (Photoshop CS2) Layer Group(s) Enabled ID. 1 byte for each layer in the document, repeated by length of the resource. NOTE: Layer groups have start and end markers (Photoshop CS3) Color samplers resource. Also see ID 1038 for old format Photoshop CS3) Measurement Scale. 4 bytes (descriptor version = 16), Descriptor (Photoshop CS3) Timeline Information. 4 bytes (descriptor version = 16), Descriptor (Photoshop CS3) Sheet Disclosure. 4 bytes (descriptor version = 16), Descriptor (Photoshop CS3) DisplayInfo structure to support floating point clors. Also see ID 1007. See Appendix A in Photoshop API Guide.pdf (Photoshop CS3) Onion Skins. 4 bytes (descriptor version = 16), Descriptor (Photoshop CS4) Count Information. 4 bytes (descriptor version = 16), Descriptor (see See Descriptor structure) Information about the count in the document. See the Count Tool (Photoshop CS5) Print Information. 4 bytes (descriptor version = 16), Descriptor (see See Descriptor structure) Information about the current print settings in the document. The color management options (Photoshop CS5) Print Style. 4 bytes (descriptor version = 16), Descriptor (see See Descriptor structure) Information about the current print style in the document. The printing marks, labels, ornaments, etc. (Photoshop CS5) Macintosh NSPrintInfo. Variable OS specific info for Macintosh. NSPrintInfo. It is recommened that you do not interpret or use this data (Photoshop CS5) Windows DEVMODE. Variable OS specific info for Windows. DEVMODE. It is recommened that you do not interpret or use this data (Photoshop CS6) Auto Save File Path. Unicode string. It is recommened that you do not interpret or use this data (Photoshop CS6) Auto Save Format. Unicode string. It is recommened that you do not interpret or use this data (Photoshop CC) Path Selection State. 4 bytes (descriptor version = 16), Descriptor Information about the current path selection state Path Information (saved paths) Name of clipping path (Photoshop CC) Origin Path Info. 4 bytes (descriptor version = 16), Descriptor Information about the origin path data Plug-In resource(s). Resources added by a plug-in. See the plug-in API found in the SDK documentation Image Ready variables. XML representation of variables definition Image Ready data sets (Photoshop CS3) Lightroom workflow, if present the document is in the middle of a Lightroom workflow Print flags information. 2 bytes version ( = 1), 1 byte center crop marks, 1 byte ( = 0), 4 bytes bleed width value, 2 bytes bleed width scale