|
krungkuene.org back |
|
krung's knowledge pages seite in deutsch |
pngcrush is a application for linux to make png files as small as possible. i tested pngcrush with different settings and options. i always used the same png file as input.
# pngcrush -version pngcrush 1.5.10, uses libpng 1.0.12 and zlib 1.1.4 [1] linux: debian woody testing [2]
[1] http://pmt.sf.net [2] http://www.debian.org
you get pngcrush as source or as debian (.deb)packages under debian gnu/linux very simple ;-) # apt-get install pngcrush
here is the starting image: # identify emule_screenshot.png emule_screenshot.png PNG 565x425 DirectClass 8-bit 57170b 0.0u 0:01

-- without any options: # pngrush emule_screenshot.png emule_screenshot_opt.png emule_screenshot_opt.png (31.09% reduction) size:39393

-- # pngcrush -brute emule_screenshot.png emule_screenshot_opt2.png -brute (Use brute-force, try 114 different methods [11-124]), needs resources le_screenshot_opt2.png (31.09% reduction) size:39393

-- # pngcrush -l 9 emule_screenshot.png emule_screenshot_opt3.png -l zlib_compression_level [0-9] le_screenshot_opt3.png (31.09% reduction) size:39393

-- # pngcrush -reduce emule_screenshot.png emule_screenshot_opt4.png -reduce (do lossless color type or bit depth reduction) le_screenshot_opt4.png (31.09% reduction) size:39393

--
# pngcrush -cc emule_screenshot.png emule_screenshot_opt5.png
-cc (do color counting)
no effect ??
out of man pngcrush:
Color counting. This option allows pngcrush to perform fur-
there optimizations on the image based on the number of colors
and the format of the imput image. With this option pngcrush
will remove an alpha channel from an opaque image and/or will
reduce a true color image that is completely grey to
greyscale representation.
le_screenshot_opt5.png (31.09% reduction) size:39393

-- # pngcrush -bit_depth 8 emule_screenshot.png emule_screenshot_opt6.png # pngcrush -bit_depth 0 emule_screenshot.png emule_screenshot_opt7.png -bit_depth depth (bit_depth to use in output file) ??? le_screenshot_opt6.png (31.09% reduction) size: 39393

le_screenshot_opt7.png (31.09% reduction) size:39393

--
-c type Set the output image color type to type, one of [0, 2, 4, or
6] (see section "Color Types" ). Future versions of pngcrush
will also allow color type 3, if there are 256 or fewer col-
ors present in the input file. Color types 4 and 6 are
padded with an opaque alpha channel if the input file does
not have alpha information. You can use 0 or 4 to convert
color to grayscale. Use 0 or 2 to delete an unwanted alpha
channel. Default is to use same color type as the input file.
Color Types. The PNG specification provides for five color types. The color type determines how the IDAT chunk will be inter-
pretend by the decoder. Choosing a color type appropriate for the color information in an image can reduce the size
(See the -cc option). Following are the PNG color types followed by their supported bit depths (Note pngcrush does
not support changing a file to color type 3 from another color type.):
· 0 : greyscale without alpha channel (1,2,4,8,16)
· 2 : true color without alpha channel (8,16)
· 3 : indexed color (1,2,4,8)
· 4 : greyscale with alpha channel (8,16)
· 6 : true color with alpha channel (8,16)
An alpha channel represents transparency on a per pixel basis. An alpha value of zero is completely transparent. An
alpha channel of 2 bitdepth-1 is completely opaque.
# pngcrush -c 0 emule_screenshot.png emule_screenshot_opt8.png
# pngcrush -c 2 emule_screenshot.png emule_screenshot_opt9.png
# pngcrush -c 4 emule_screenshot.png emule_screenshot_opt10.png
# pngcrush -c 6 emule_screenshot.png emule_screenshot_opt11.png
emule_screenshot_opt8.png (56.67% reduction) 24770 black & white

emule_screenshot_opt9.png (31.09% reduction) 39393 - normal

emule_screenshot_opt10.png (48.03% reduction) 29709 black & white

emule_screenshot_opt11.png (24.05% reduction) 43420

-- -bit_depth n Force output bit depth to n. See Section "Color Types" for bit depth restrictions. makes only sens with -c : # pngcrush -c 2 -bit_depth 8 emule_screenshot.png emule_screenshot_opt12.png # pngcrush -c 2 -bit_depth 16 emule_screenshot.png emule_screenshot_opt13.png # pngcrush -c 4 -bit_depth 8 emule_screenshot.png emule_screenshot_opt14.png # pngcrush -c 3 -bit_depth 2 emule_screenshot.png emule_screenshot_opt15.png no effect ?? emule_screenshot_opt12.png (31.09% reduction) 39393

emule_screenshot_opt13.png (24.77% reduction) 43007

emule_screenshot_opt14.png (48.03% reduction) 29709

emule_screenshot_opt15.png (31.09% reduction) 39393 ???

# display -verbose emule_screenshot_opt15.png emule_screenshot_opt15.png PNG 565x425 DirectClass 8-bit 39393b 0.5u 0:14 looks like no index color with bit_depth 2 and from the man: Future versions of pngcrush will also allow color type 3, if there are 256 or fewer colors present in the input file. or: # pngcrush -bit_depth 2 emule_screenshot.png emule_screenshot_opt14.png emule_screenshot_opt14.png (31.09% reduction) 39393

using pngcrush without any option is for normal images ok, for images with indexed color, i don't know yet ! but i think it behaves rather intelligent - so will with indexed color. more info: # man pngcrush or # pngcrush -help