Navigation
  • Home
  • Recent
  • Most Active
  • Popular
  • Blog
  • Credits
  • RSS
  •   Interaction
  • Register
  • Statistics
  •   Help
  • Suggestions
  • Contact Us
  • How to Edit
  • Help



  • [Edit]




    PNG (Portable Network Graphics) is a bitmap image format that employs lossless data compression. PNG was created to both improve upon and replace the GIF format with an image file format that does not require a patent license to use. PNG is officially pronounced as "ping" ( in IPA), but it is often just spelled out — possibly to avoid confusion with the network tool ping. PNG is supported by the libpng reference library, a platform-independent library that contains C functions for handling PNG images.

    PNG supports palette based (with a palette defined in terms of the 24 bit RGB colors), greyscale and RGB images. PNG was designed for distribution of images on the internet not for professional graphics and as such other color spaces (such as CMYK) are not supported.

    PNG files nearly always use the file extension PNG or png and are assigned the MIME media type image/png (approved on October 14 1996).


        PNG
            History and development
                File header
                "Chunks" within the file
                    Essential chunks
                    Metadata chunks
                Colour depth
                Transparency of image
                Compression
                Interlacing
                Animation
            Technical comparison with GIF
            Bitmap graphics editor support for PNG
            Web browser support for PNG
            File size and optimization software
            Comparison with JPEG
            Comparison with TIFF
            See also
                libpng.org
                W3C
                Others
                Internet Explorer incompatibility
    NamePortable Network Graphic
    ScreenshotImage:PNG transparency demonstration 1.png, I...
    CaptionA PNG image with an 8-bit transparency channe...
    Extension.png
    Mimeimage/png
    TypecodePNGf
    Uniform Typepublic.png
    GenreLossless data compression
    OwnerW3C
    ExtendedtoAPNG, JNG and Multiple-image Network Graphics
    StandardInternational Organization for Standardizatio...

    top

    History and development
    The motivation for creating the PNG format came in early 1995, after Unisys announced that it would be enforcing software patents on the LZW data compression algorithm used in the GIF format (the acronym PNG was originally recursive, standing for "PNG's Not GIF" *. For more on this controversy see GIF (Unisys and LZW patent enforcement). There were also other problems with the GIF format which made a replacement desirable, notably its limitation to 256 colors at a time when computers capable of displaying far more than 256 colors were becoming common. Although GIF allows for animation, it was decided that PNG should be a single-image format. A companion format called MNG has been defined for animation. PNG gained some additional popularity in August 1999, after Unisys terminated its royalty-free patent licenses to developers of free software and non-commercial software.

      1996-10-01 Version 1.0 of the PNG specification was released, and later appeared as RFC 2083. It became a W3C Recommendation on 1996-10-01.
      1998-12-31 Version 1.1, with some small changes and the addition of three new chunks, was released.
      1999-08-11 Version 1.2, adding one extra chunk, was released.
      2003-11-10 PNG is now an International Standard (ISO/IEC 15948:2003). This version of PNG differs only slightly from version 1.2 and adds no new chunks.

    top

    File header
    A PNG file starts with an 8-byte signature. The hexadecimal byte values are 89 50 4E 47 0D 0A 1A 0A. Each of the header bytes is there for a specific reason *:


    top

    "Chunks" within the file
    After the header come a series of chunks each of which conveys certain information about the image. Chunks declare themselves as critical or ancillary, and a program encountering an ancillary chunk that it does not understand can safely ignore it. This chunk-based structure is designed to allow the PNG format to be extended while maintaining compatibility with older versions.

    The chunks each have a header specifying their size and type. This is immediately followed by the actual data, and then the checksum of the data. Chunks are given a 4 letter case sensitive name. The case of the different letters in the name provides the decoder with some information on the nature of chunks it does not recognise.

    The case of the first letter indicates if the Chunk is essential or not. If the first letter is uppercase, the chunk is essential. If not, the chunk is ancillary. Essential chunks contain information that is necessary to read the file. If a decoder encounters an essential chunk it does not recognise, it must abort reading the file.

    The case of the second letter indicates if the chunk is "public" (either in the specification or the registry of special purpose public chunks) or "private" (not standardised). Uppercase is public and lowercase is private. This ensures that public and private chunk names can never conflict with each other.

    The third letter must be uppercase to conform to the PNG specification. It is reserved for future expansion.

    The case of the fourth letter indicates if a chunk is safe to copy by editors that do not recognise it. If lowercase, the chunk may be safely copied regardless of the extent of modifications to the file. If uppercase, it may only be copied if the modifications have not touched any critical chunks.

    top

    Essential chunks
    A decoder must be able to interpret these to read and render a PNG file.
      IHDR must be the first chunk, it contains the header.
      PLTE contains the palette; list of colors.
      IDAT contains the image, which may be split among multiple IDAT chunks. Doing so increases filesize slightly, but makes it possible to generate a PNG in a streaming manner.
      IEND marks the image end.

    top

    Metadata chunks
    Other image attributes that can be stored in PNG files include gamma values, background color, and textual metadata information. PNG also supports color management through the inclusion of ICC color space profiles.
      bKGD gives the default background color. It is intended for use when there is no better choice available, such as in standalone image viewers (but not web browsers).
      hIST can store the histogram, or total amount of each color in the image.
      iCCP is an ICC color profile.
      iTXt contains international (UTF-8) text, compressed or not.
      pHYs holds the intended pixel size and/or aspect ratio of the image.
      sBIT (significant bits) indicates the color-accuracy of the source data.
      sPLT suggests a palette to use if the full range of colors is unavailable.
      tEXt can store text that can be represented in ISO 8859-1, with one name=value pair for each chunk.
      tIME stores the time that the image was last changed.
      tRNS contains transparency information. For indexed images, it stores alpha channel values for one or more palette entries. For truecolor and greyscale images, it stores a single pixel value that is to be regarded as fully transparent.
      zTXt contains compressed text with the same limits as tEXt.

    The lowercase first letter in these chunks indicates that they are not needed for the PNG specification. The lowercase last letter in some chunks indicates that they are safe to copy, even if the application concerned does not understand them.

    top

    Colour depth
    PNG images can either use palette-indexed color or be made up of one or more channels (numerical values directly representing quantities about the pixels). When there is more than one channel in an image all channels have the same number of bits allocated per pixel (known as the bitdepth of the channel). Although the PNG specification always talks about the bitdepth of channels, most software and users generally talk about the total number of bits per pixel (sometimes also referred to as bitdepth or color depth).

    The number of channels will depend on whether the image is greyscale or color and whether it has an alpha channel. PNG allows the following combinations of channels:
      greyscale
      greyscale and alpha (level of transparency for each pixel)
      red, green and blue (rgb/truecolor)
      red, green, blue and alpha



    With indexed color images, the palette is always stored at a depth of 8 bits per channel. The palette must not have more entries than the image bitdepth allows for but it may have fewer (so if an image for example only uses 90 colors there is no need to have palette entries for all 256).

    Indexed color PNGs are allowed to have 1, 2, 4 or 8 bits per pixel by the standard; greyscale images with no alpha channel allow for 1, 2, 4, 8 or 16 bits per pixel. Everything else uses a bitdepth per channel of either 8 or 16. The combinations this allows are given in the table above. The standard requires that decoders can read all supported color formats but many image editors can only produce a small subset of them.

    top

    Transparency of image
    PNG offers a variety of transparency options. With truecolor and greyscale images either a single pixel value can be declared as transparent or an alpha channel can be added. For paletted images, alpha values can be added to palette entries. The number of such values stored may be less than the total number of palette entries, in which case the remaining entries are considered fully opaque.

    The scanning of pixel values for binary transparency is supposed to be performed before any color reduction to avoid pixels becoming unintentionally transparent. This is most likely to pose an issue for systems that can decode 16 bits per channel images (as they must to be compliant with the specification) but only output at 8 bits per channel (the norm for all but the highest end systems).

    top

    Compression
    PNG uses a non-patented lossless data compression method known as deflation. This method is combined with prediction, where for each image line, a filter method is chosen that predicts the color of each pixel based on the colors of previous pixels and subtracts the predicted color of the pixel from the actual color. An image line filtered in this way is often more compressible than the raw image line would be, especially if it is similar to the line above (since deflate has no understanding that an image is a 2D entity, and instead just sees the image data as a stream of bytes).

    top

    Interlacing
    PNG offers an optional 2-dimensional, 7-pass interlacing scheme – the Adam7 algorithm. This is more sophisticated than GIF's 1-dimensional, 4-pass scheme, and allows a clearer low-resolution image to be visible earlier in the transfer. However, as a 7-pass scheme, it tends to reduce the data's compressibility more than simpler schemes.

    top

    Animation
    PNG does not offer animation. MNG is an image format that supports animation and is based on the ideas and some of the chunks of PNG but is a complex system and does not offer fallback to single image display like GIF does. APNG is another image format based on PNG that supports animation and is simpler than MNG. APNG offers fallback to single image display for PNG decoders that do not support APNG. However neither of these formats are widely supported.

    top

    Technical comparison with GIF
      On most images, PNG can achieve greater compression than GIF (see the section on filesize, below).
      PNG gives a much wider range of transparency options than GIF, including alpha-channel transparency.
      PNG gives a much wider range of color depths than GIF (truecolor up to 48-bit compared to 8-bit 256-color), allowing for greater color precision, smoother fades, etc. *
      PNG images are not as widely supported as GIF images.

    top

    Bitmap graphics editor support for PNG


    Macromedia Fireworks uses PNG as its native file format but by default also stores metadata for layers, animation, text and effects. Such files should not be distributed directly. Fireworks can instead export as an optimised PNG without the extra metadata for use on webpages etc.*

    Other popular graphics programs which support the PNG format include Adobe Photoshop, Pixel image editor, The GIMP and GraphicConverter. Programs that support PNG and are bundled with popular operating systems include Microsoft's Paint and Apple's iPhoto.

    Some image processing programs have PNG compression problems, mainly related to lack of full implementation of the PNG compressor library:
      Microsoft's Paint for Windows XP
      Microsoft Picture It! Photo Premium 9.
      Macromedia Fireworks

    top

    Web browser support for PNG


    Despite campaigns such as "burn all gifs" *, tools such as gif2png *, calls by the Free Software Foundation, and influential writers, PNG adoption on websites has been fairly slow.

    GIF is still more widely used than PNG, partially due to misconceptions but also for several more accurate reasons:
      On very old browsers such as Internet Explorer 3, PNG support may not be available

    The full feature set of PNG is not often used on the web, for several reasons:
      Internet Explorer 4 can crash on images containing metadata (e.g. Macromedia Fireworks's native PNG file format)
      Versions of Internet Explorer up to and including 6 do not support native alpha-channel transparency (although a JavaScript fix is possible for clients using IE 5.5 to 6 *, it only works for inline images, not for background images).

    The fact that Internet Explorer 4.0-6.0 did not support alpha-channel transparency has led some people to erroneously believe that Internet Explorer does not support transparency at all. However PNGs can be given a single transparent background color, which works on IE, and is equivalent to the transparency available with GIF images.

    There are also a number of methods using DirectX functions in style sheets and HTML that can make Internet Explorer display full transparency data in PNG images on web pages.

    Internet Explorer also renders PNGs in a slightly incorrect color gamut. If a GIF and PNG image of several colors are placed side-by-side on a page, a user can often see a slight difference in color. While accurate color can never be guaranteed due to monitor and other computer differences among users, it can cause difficulty to web designers attempting to use several image formats on a page where color matching is important. There is an interesting partial fix * using a PHP script which utilizes the GD Graphics Library (phpGD) to alter PNG images to display correctly in affected versions of Internet Explorer.

    Internet Explorer 7.0 has addressed the PNG-rendering issues, and now displays them correctly.

    Apple's Safari, Mozilla Firefox, and Opera have full PNG compatibility. For the complete comparison, see Comparison of web browsers#Image format support.

    top

    File size and optimization software







    Generally, PNG files created by a decent encoder and without unwanted metadata should be smaller than the identical image encoded in GIF format. However, PNG gives the image creator far more flexibility than GIF and care needs to be taken to avoid PNG files that are needlessly large.

    As GIF is limited to 256 colors, many image editors will automatically reduce the color depth when saving an image in GIF format. Often when people save the same truecolor image as PNG and GIF, they see that the GIF is smaller, and do not realise it is possible to create a 256 color PNG that has identical quality to the GIF with a smaller file size. This leads to the misconception that PNG files are larger than equivalent GIF files.

    Some versions of Adobe Photoshop and CorelDRAW have poor PNG output support, further fuelling the idea that PNG is larger than GIF. Many graphics programs (and even Apple's Preview software) save PNGs with large amounts of metadata and color-correction data that's generally unnecessary. Unoptimized PNG files from Macromedia Fireworks are also notorious for this.

    Various tools are available for optimizing PNG files. OptiPNG and pngcrush are both open-source software optimizers that run from a Unix command line or a Windows Command Prompt, and are very effective at reducing the size of PNG files.

    Other tools such as AdvanceCOMP and Ken Silverman's PNGOUT are capable of reducing the file size even further, giving the competent user the smallest file size possible for a given PNG image. The current version of IrfanView can use PNGOUT as an external plug-in, and the screenshots show PNGOUT's save options.

    pngcrush and PNGOUT have the extra ability to remove all color correction data from PNG files (gamma, white balance, ICC color profile, standard RGB color profile). This often results in much smaller file sizes. The following command line options achieve this with pngcrush:

    pngcrush -rem gAMA -rem cHRM -rem iCCP -rem sRGB InputFile.png OutputFile.png

    PNG was not intended to replace the other popular web image format JPEG. See the Comparison with JPEG section below for more details on how the two formats compare.


    top

    Comparison with JPEG


    JPEG will produce a smaller file than PNG for photographic (and photo-like) images since it uses a lossy encoding method specifically designed for photographic image data. Using PNG instead of a high-quality JPEG for such images would result in a large increase in filesize (often 5-10 times) with negligible gain in quality.

    PNG is a better choice than JPEG for storing images that contain text, line art, or other images with sharp transitions that do not transform well into the frequency domain. Where an image contains both sharp transitions and photographic parts a choice must be made between the large but sharp PNG and a small JPEG with artifacts around sharp transitions.

    JPEG is a poor choice for storing images that require further editing as it suffers from generation loss, whereas lossless formats do not. This makes PNG useful for saving temporary photographs that require successive editing. When the photograph is ready to be distributed, it can then be saved as a JPEG, and this limits the information loss to just one generation. That said, PNG does not support Exif image data from sources such as digital cameras, which makes it problematic for use amongst amateur and especially professional photographers. TIFF does support it as a lossless format, but is much larger in file size for an equivalent image.

    JPEG has historically been the format of choice for exporting images containing gradients, as it could handle the color depth much better than the GIF format. However, any compression by the JPEG would cause the gradient to become blurry, but a 24-bit PNG export of a gradient image often comes out identical to the source vector image, and at a small file size. As such, the PNG format is the optimal choice for exporting small, repeating gradients for web usage.

    top

    Comparison with TIFF
    TIFF is a complicated format that incorporates an extremely wide range of options. While this makes it useful as a generic format for interchange between professional image editing applications, it makes supporting it in more general applications such as Web browsers difficult. It also means that many applications can only read a subset of TIFF types creating more potential user confusion.

    The most common general-purpose lossless compression algorithm used with TIFF is LZW, which is inferior to PNG and until expiration in 2003 suffered from the same patent issues that GIF did. There is an option to use the same compression algorithm with TIFF as PNG uses, but it is not supported by many proprietary programs. TIFF also offers special-purpose lossless compression algorithms like CCITT Group IV, which can compress black and white text better than PNG's compression algorithm.

    top

    See also
        XPM for portable icons

    top

    libpng.org

    top

    W3C

    top

    Others
      RFC 2083

    top

    Internet Explorer incompatibility







     
    Search more:
     

       
    Source Privacy License Download Contact Us Atlas
    Scientus.org Dictionary (Yet Another Wiki) RC : 1.39
    This article is licensed under the GNU Free Documentation License [copyleft]. It uses material from the Wikipedia article "PNG". link