The PNG Guide is an eBook based on Greg Roelofs' book, originally published by O'Reilly.

Physical Scale (sCAL)

  • Status:   officially registered (PNG Extensions)
  • Location:   before first IDAT
  • Multiple:   no

PNG's sCAL chunk is similar to pHYs, except that instead of measuring the size of the image pixels relative to each other or to an original, physical image, sCAL measures their size relative to the actual subject matter of the image. For example, an astronomical image may span a certain number of radians in each direction, or an aerial photograph of Earth may cover a given number of kilometers.

Table 11-5 shows the format of sCAL; it is quite simple.

Table 11-5. sCAL Chunk

Field Length and Valid Range
Unit specifier 1 byte (1, 2)
Units per pixel, x axis m bytes (positive floating-point)
Null separator 1 byte (0)
Units per pixel, y axis n bytes (positive floating-point)

Two units are defined: meters (unit specifier = 1) and radians (unit specifier = 2). The size of a pixel in the given units, both horizontally and vertically, is given by a pair of positive floating-point numbers encoded as ASCII strings and separated by a null byte. The most general form of a floating-point string includes an optional leading sign (+ or -), zero or more decimal digits (0-9, the ``integer part''), an optional decimal point followed by zero or more decimal digits (the ``fractional part''), and an optional e or E followed by an optional sign and one or more digits (the ``exponent part''). Either the integer part or the fractional part must contain at least one digit, but everything else may be omitted. Thus, 1 and .1 are valid floating-point numbers, as is +123.4567e-089. Note that the exponent is interpreted as a power of 10 (10-89 in the third example) to be multiplied by the integer and fractional parts; this is the computer version of what is sometimes referred to as scientific notation.

Last Update: 2010-Nov-26