Menu
A Blog to Phone
  • Definitions
  • Acronyms
  • Medical
  • Technology
  • Geography
  • Business
  • Education
A Blog to Phone
PNG – Portable Network Graphics

PNG – Portable Network Graphics

Posted on September 5, 2021September 23, 2021 by ablogtophone

PNG (Portable Network Graphics, see Abbreviationfinder.org) is a graphical format based on algorithm of lossless compression for bitmaps not subject to patents. This format was developed in large part to overcome the deficiencies of the GIF format and allows you to store images with a greater depth of contrast and other important data.

History and development

The motivations for creating the PNG format were generated in 1995, after the company Unisys announced that it would enforce the patent software algorithm data compression LZW used by the GIF (Patent US 4,558,302 and others in the rest of the world). There were other problems with the GIF format that made a change desirable, for example limiting it to 8-bit palettes of 256 colors maximum, when computers already supported thousands or millions of colors.

Originally PNG was a recursive acronym that meant PNG is not GIF (PNG’s Not GIF). Although GIF supports animation, PNG was developed as a static image format and the MNG format was created as its animated variant.

PNG grew in popularity in August 1999 when Unisys ended its policy of royalty-free patent licenses for developers of free or non-commercial software.

  • Specification Version 1.0 of PNG was launched on 1 of July of 1996 and later appeared as RFC 2083. It quickly became a recommendation W3C the 1 of October of 1996
  • Version 1.1 with some small changes and with 3 new extensions or “chunks” was released on December 31, 1998
  • Version 1.2. New extension. She was released on August 11, 1999
  • New version, slightly different from the previous one and with a new extension. Currently PNG is an international standard (ISO / IEC15948: 2003), also recommended by the W3C on November 10, 2003.
  • The standard as of 2004 is (ISO / IEC 15948: 2004)

Technical details

A PNG file starts with an 8-byte signature, the hexadecimal values ​​are: 89 50 4E 47 0D 0A 1A 0A, the decimal values ​​are: 137 80 78 71 13 10 26 10; each value is there for a specific reason.

Byte (s) Purpose
89 It has the highest bit set to 1 to detect transmission systems that do not support 8-bit data and to reduce the risk that a text file will be mistakenly interpreted as PNG.
50 4E 47 In ASCII, the letters “PNG” allow a person to identify the format if viewed in a text editor.
0D 0A A new DOS- style line (CRLF) to detect end-of-line conversions between DOS and UNIX.
1A A byte that stops the display of the file under DOS when the TYPE command has been used.
0A A new line on UNIX (LF) to detect end-of-line conversion between DOS and UNIX.

File segments

After the header there are a series of segments of which each one stores certain information about the image. Segments are self-declared as critical (critical) or auxiliary (ancillary) so that a program that encounters an auxiliary segment and does not understand it can safely ignore it. The segment-based structure is designed to be able to extend the PNG format while maintaining compatibility with older versions.

Each of the sections has a header that specifies its size and type, immediately followed by the data and the checksum of the data. Sections have a 4-letter name that is case sensitive. The use of upper or lower case in this name provides decoders with information about the sections that are not recognized.

If the first letter is capitalized this indicates that the section is essential, otherwise it will be auxiliary. The essential sections are necessary to read the file, if the decoder finds an essential section that it does not recognize, it must abort the reading.

In case the second letter is capitalized this will mean that the section is public in the specification or registration of sections for special purposes, otherwise it will be private (not standardized). This use of upper and lower case ensures that there are never any conflicts between public and private sections.

The third letter must be capitalized to meet PNG specifications and is reserved for future expansion.

The fourth letter indicates if it is safe to copy the section if it is not recognized, if it is in lowercase it is safe to copy the section regardless of the amount of modification that the file has undergone, if it is uppercase it should only be copied if not there are critical sections that have undergone modifications.

Metadata sections

Other attributes that can be saved in a PNG image are: gamma values, background color and textual information. PNG also supports color correction with the use of color management systems such as sRGB.

  • bKGD – Contains the default background color, used when there is no best color available to display, such as in an image viewer but not in a web browser.
  • cHRM: white balance.
  • gAMA: specifies the gamma.
  • hIST: saves the histogram or total amount of each color in the image.
  • iCCP: ICC color profile.
  • iTXt: contains text (UTF-8) compressed or not.
  • pHYs – Contains the expected pixel size and / or image ratio.
  • sBIT: (significant bits) indicate the accuracy of the colors in the image.
  • sPLT: suggests a palette to use in case the full range of colors is not available.
  • sRGB: indicates that the sRBG color space standard is used.
  • tEXt: stores text that can be represented in ISO 8859-1 with a name = value for each section.
  • tIME: stores the date of the last modification.
  • tRNS – Contains information about transparency. For indexed images it stores the alpha channel for one or more palettes, for real color and grayscale images it stores the information of a single pixel that must be considered completely transparent.
  • zTXt – Contains compressed text with the same limits as tEXt.

The first lowercase letter in these sections indicates that they are not required in the PNG specification, the last lowercase letter indicates that they are safe to copy even if the application in question does not understand them.

Other attributes that can be stored in a PNG include gamma correction values, background color, and metadata. PNG also also uses color correction using the management systems color as sRGB. Some programs like Adobe Photoshop have this system.

Color depth

Images in PNG format can be indexed palette images or consist of one or more channels. If there is more than one channel, all the channels have the same number of bits per pixel (also called the bit depth per channel). Although the official PNG specification names the bit depth per channel, normally editing programs name only the total number of bits per pixel, that is, the color depth.

The number of channels depends on whether the image is grayscale or color and whether it has an alpha channel (also called a transparency channel). The combinations allowed by PNG are:

  • Grayscale (1 channel).
  • Grayscale and alpha channel (2 channels).
  • Red, green and blue channels (RGB, 3 channels, also called true color or Truecolor).
  • Red, green, blue and alpha channels (RGB + alpha, 4 channels).

On the other hand, indexed images are capped at a maximum of 256 colors. This color palette is stored with a channel depth of 8 bits. The palette cannot have more colors than those marked by the bit depth, that is, 2 8 = 256 colors, although it can have fewer (for example, a 50 color image will only store 50 entries, avoiding storing data that is not used).

The table on the right indicates the color depth for each image format that PNG supports. This is taken from the bit depth per channel and multiplied by the number of channels. The boxes in red represent unsupported combinations. The standard requires decoders to be able to read all available formats, but many image editors can only output a small subset of them.

Essential sections

A decoder must be able to understand these sections to read and render a PNG:

  • IHDR, it must be the first section, it contains the header.
  • PLTE, contains the palette (list of colors).
  • IDAT, contains the image that must be divided into multiple IDAT sections, doing this increases the size of the image slightly but makes it possible to generate PNG images in streaming.
  • IEND marks the end of the image.

Image transparency

PNG offers a wide variety of transparency options. With true color or grayscale, even a single pixel can be declared transparent or an alpha channel can be added. For images that use palettes, an alpha channel can be added to the palette inputs. The number of such stored values ​​can be less than the total number of entries in the palette, so the rest of the entries will be considered completely opaque.

Searching for pixels with binary transparency should be done before any color reduction to prevent some pixels from accidentally becoming transparent.

Compression

The compression method used by PNG is known as deflation (in English ” Deflate algorithm “). There are also filtering methods. Specification 1.2 defines a single type of filter, which includes 5 prediction modes of the pixel value, which is very useful to improve compression, where a filtering method is chosen for each line of the image (scanline) that predicts the color of each pixel based on the previous pixel colors and subtracts the predicted color from the current pixel color. The five methods are: None, Sub, Up, Average, and Paeth.

These filters can significantly reduce the final file size, although it is highly dependent on the input image. The compression algorithm can take care of the appropriate choice of the method that offers the greatest reduction.

The MIME media type for PNG is “image / png” (approved October 14, 1996).

PNG – Portable Network Graphics

©2023 A Blog to Phone