Pngcrush

Pngcrush

Infobox_Software
name = pngcrush


caption = pngcrush 1.5.10
developer = Glenn Randers-Pehrson
latest_release_version = 1.6.10 (executable)
latest_release_date = release date|2008|09|28
operating_system = Cross-platform
genre = Image optimizer
license = OSI Approved License
website = [http://pmt.sourceforge.net/pngcrush/ pmt.sf.net/pngcrush/]

pngcrush is an open source, free command line computer program that reduces the size of PNG files. The compression is lossless, meaning that the resulting image will have the same quality as the source image. The main purpose of pngcrush is to reduce the size of the PNG IDAT datastream by trying various compression levels. However, pngcrush can also be used for various manipulations of PNG images, such as changing the bit depth. Some operations can even increase the file size.

There is an optional "-brute" option, which performs a brute force crush when set: rather than use one of a few common methods to crush the file, it will try all of them.

Main operation

The main use of pngcrush is for reducing the size of the image data contained in the IDAT section. PNG uses DEFLATE compression which can vary in speed and compression ratio, from nearly no compression at all but at very high speed to the very good compression ratio, albeit at a lower speed. The PNG compressors built into many paint programs may not always apply the maximum amount of compression possible, and it is on images from these programs that pngcrush performs best.

pngcrush generates an "optimised" file from an unoptimised one using the following format on the command line:

pngcrush imageIn.pngimageOut.png

pngcrush may not always generate the smallest PNG file possible. Because of different or more exhaustive search strategies being used, some other programs may give better results by several percent on certain files. OptiPNG, AdvanceCOMP and PNGOUT, for example, can sometimes outperform pngcrush in regards to PNG file sizes, although the time taken (and in some cases, the required manual labour on the user's behalf) to reach the result is usually increased.

Reducing filesize by removing color-correction data

pngcrush has one advantage over the other programs because it can remove all the color-correction data (gamma, white balance, ICC color profile, standard RGB color profile) from PNG files, using the following command line options:

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

Since most graphics software embed the extra color-correction data, which is normally not needed, this can produce file sizes that are up to 40 % smaller than the original. Greater reductions come from PNG images that have 256 colors or less (indexed color).

Image manipulation

pngcrush can be used to change the parameters of an image. For example, if an image contains 10 colours but has a colour palette of 256 entries (8-bit), pngcrush can be used to reduce the colour palette to a 4-bit one and truncate the palette to 10 entries:

pngcrush -bit_depth 4 -plte_len 10 "image1.png" "image2.png"

pngcrush can also change the colour type of the image. For a truecolour image, changing the colour type from 2 to 0 (-c 0) converts it to greyscale. For a truecolour-alpha image, changing the colour type from 6 to 2 removes the alpha channel.

Chunk and metadata manipulation

PNG images contain chunks with information about the image, such as its resolution (the phys chunk), the time it was last modified (the tIME chunk) and textual metadata (the text chunk and its variants). With pngcrush the user can edit or remove those ancillary chunks:

pngcrush -res 96 -rem time -text b "Software" "pngcrush" image1.pngimage2.png

The above command sets the image resolution to 96 dpi, removes the timestamp and writes a textual metadata chunk describing pngcrush as the creation software of the image.

See also

Similar PNG compression programs include:
* AdvanceCOMP
* OptiPNG
* PNGOUT
*

External links

* [http://pmt.sourceforge.net/pngcrush/ pngcrush home page]
* [http://gnuwin32.sourceforge.net/packages/pngutils.htm pngutils for the Win32 console]
* [http://www.neilturner.me.uk/2005/Feb/05/quickly_compress_png_images.html Quickly compress PNG images] - Adds the "crush" option to the context menu of Windows Explorer.


Wikimedia Foundation. 2010.

Look at other dictionaries:

  • Pngcrush — Тип Оптимизатор изображений Автор Glenn Randers Pehrson Написа …   Википедия

  • Pngcrush — Screenshot Pngcrush ist ein freies Kommandozeilenwerkzeug, um die Komprimierung von PNG Bilddateien zu optimieren, wodurch die Dateigröße in den meisten Fällen verkleinert wird. Die erneute Kompression erfolgt ohne Qualitätsverluste. Pngcrush… …   Deutsch Wikipedia

  • Portable Network Graphics — PNG A PNG image with an 8 bit transparency channel (top). The same image is overlaid onto a checkered background (botto …   Wikipedia

  • OptiPNG — Тип Сжатие изображений Разработчик Cosmin Truţa Написана на …   Википедия

  • .png — Portable Network Graphics Dateiendung .png MIME Type image/png, image/x png …   Deutsch Wikipedia

  • Image/png — Portable Network Graphics Dateiendung .png MIME Type image/png, image/x png …   Deutsch Wikipedia

  • PNG-Format — Portable Network Graphics Dateiendung .png MIME Type image/png, image/x png …   Deutsch Wikipedia

  • Png — Portable Network Graphics Dateiendung .png MIME Type image/png, image/x png …   Deutsch Wikipedia

  • Portable Network Grafics — Portable Network Graphics Dateiendung .png MIME Type image/png, image/x png …   Deutsch Wikipedia

  • Portable Network Graphic — Portable Network Graphics Dateiendung .png MIME Type image/png, image/x png …   Deutsch Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”