The quantization and dithering code in pngquant is lifted from Jef Poskanzer's 'ppmquant', part of his wonderful PBMPLUS tool suite. Greg Roelofs hacked it into a (in his words) "slightly cheesy" 'pamquant' back in 1997 (see http://pobox.com/~newt/greg_rgba.html) and finally he ripped out the cheesy file-I/O parts and replaced them with nice PNG code in December 2000. The PNG reading and writing code is a merged and slightly simplified version of readpng, readpng2, and writepng from his book "PNG: The Definitive Guide." In 2014 Greg has relicensed the code under the simplified BSD license. Note that both licenses are basically BSD-like; that is, use the code however you like, as long as you acknowledge its origins. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - pngquant.c: © 1989, 1991 by Jef Poskanzer. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. This software is provided "as is" without express or implied warranty. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - pngquant.c and rwpng.c/h: © 1997-2002 by Greg Roelofs; based on an idea by Stefan Schneider. © 2009-2014 by Kornel Lesiński. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.