1Image::Pngslimmer version 0.30 2============================= 3 4OVERVIEW 5 6Image::Pngslimmer reduces the size of PNGs by removing non-critcal chunks and 7recompressing, filtering or palettizing images. 8 9Other tools, such as pngcrush (http://pmt.sourceforge.net/pngcrush/) 10will deliver better results for static PNGs and Image::Pnglimmer 11was orginally designed for dynamically created PNGs. 12 13use Image::Pngslimmer 14 15Image::Pngslimmer::ispng($blob) - returns 1 if the BLOB conforms to the 16structure for a PNG and that all CRCs are correct. 17 18Image::Pngslimmer::discard_noncritical($blob) - returns a BLOB stripped of any 19non-critcal chunks. If the passed-in BLOB does not conform to the basic 20structure of a PNG the returned BLOB is identical to the passed-in BLOB. 21The passed in BLOB is not altered by this function. 22 23Image::Pngslimmer::analyze($blob) - after calling Image::Pngslimmer::ispng($blob) 24this will iterate through the chunks in the supplied byte stream represented by 25$blob and return an array of strings describing the chunks in the PNG. It can be 26useful for testing the "before and after" effect of discard_noncritical($blob). 27 28Image::Pngzlimmer::zlibshrink($blob) will attempt to improve compression of the 29supplied BLOB. 30 31Image::Pngslimmer::filter($blob) will attempt to apply adaptive filtering for 32better compression of the supplied BLOB - filtering normally results in better 33compression once zlibshrink() is reapplied if the original image is truecolour. 34 35Image::Pngslimmer::indexcolours($blob) will attempt to losslessly convert the 36supplied PNG to a colour indexed image - of the image contains more than 256 37colours this will not work and the original PNG is returned instead. 38 39Image::Pngslimmer::palettize($blob[, $colours[, $dither]]) will colour index 40(with a PLTE chunk) a 24 bit RGB image. If the original image has 256 41colours or less it will do this losslessly by calling indexcolours(), otherwise 42it will generate a palette by using the median cut algorithm. The size of the 43palette can be set by the optional $colours in the range 1 - 256 (the defult 0 44gives 256 colours). If the optional $dither is set to 1, then the output image 45will be dithered. 46 47Dithering is now up to 75 (!) times faster than in previous versions though 48still 3 - 5 times slower than simple quantization for most images. 49 50NB: Alpha channels in the original image will be lost with with quantization 51or indexation. 52 53 54Image::Pngslimmer::reportcolours($blob) will print details of the colour 55frequencies in the passed in PNG. 56 57 58INSTALLATION 59 60To install this module type the following: 61 62 perl Makefile.PL 63 make 64 make test 65 make install 66 67DEPENDENCIES 68 69 70POSIX 71Compress::Zlib 72Compress::Raw::Zlib 73 74 75COPYRIGHT AND LICENCE 76 77 78Copyright (C) 2006, 2007, 2008 by Adrian McMenamin 79<adrian AT mcmen DOT demon DOT co DOT uk> 80 81This library is free software; you can redistribute it and/or modify 82it under the same terms as Perl itself, either Perl version 5.8.4 or, 83at your option, any later version of Perl 5 you may have available. 84