Skip to content

Lossy PNG compressor for RGBA PNGs. Has two modes: lossy averaging filter (blurizer) that denoises the image and optimal posterization using Median Cut quantization to reduce number of unique colors in the image with minimal visual distortion

Notifications You must be signed in to change notification settings

frossi85/mediancut-posterizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

69 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lossy compressors for true-color PNGs

Median Cut PNG Posterizer

Reduces number of distinct color/alpha intensities in the image. Unlike typical posterization, which distributes levels evenly, this one tries to pick levels intelligently using varaince-based Median Cut and Voronoi iteration.

The goal of this tool is to make RGB/RGBA PNG images more compressible, assuming that lower number of unique byte values increses chance of finding repetition and improves efficiency of Huffman coding.

Blurizer

With -b argument it reduces PNG file sizes by selectively blurring the image. It makes image more compressible by making it more predictable for PNG's diagonal average prediction filter.

Usage

posterize [ -v ] [ -b ] [ -d ] [ -Q <quality> ] [ levels ] -- [ input.png ] [ output.png ]
  • -b — Use blurring instead of posterization (recommended). Without this argument posterization is used.
  • -Q num — Picks minimum number of levels needed to achieve given quality. num is quality 0-100 (100 is best, similar to JPEG). Number of levels is optional if quality is specified.
  • levels — Number of levels to use (2-255). Lower number gives worse quality, but smaller file.
  • -d — Enables simple ordered dithering in posterization mode.
  • -v — Verbose output. Prints mean square error (MSE) caused by posterization.

If input/output files are not specified then stdin/stdout is used respectively.

Posterized images can be further compressed using PNGOUT or similar. Try ImageOptim.

GUI?

Integrated in ImageAlpha.app.

Licenses

Posterizer

© 2011-2014 Kornel Lesiński.

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

###rwpng.c

© 1998-2000 Greg Roelofs. All rights reserved.

This software is provided "as is," without warranty of any kind, express or implied. In no event shall the author or contributors be held liable for any damages arising in any way from the use of this software.

Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:

  1. Redistributions of source code must retain the above copyright notice, disclaimer, and this list of conditions.

  2. Redistributions in binary form must reproduce the above copyright notice, disclaimer, and this list of conditions in the documenta- tion and/or other materials provided with the distribution.

  3. All advertising materials mentioning features or use of this software must display the following acknowledgment:

    This product includes software developed by Greg Roelofs and contributors for the book, "PNG: The Definitive Guide," published by O'Reilly and Associates.

About

Lossy PNG compressor for RGBA PNGs. Has two modes: lossy averaging filter (blurizer) that denoises the image and optimal posterization using Median Cut quantization to reduce number of unique colors in the image with minimal visual distortion

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C 94.3%
  • Objective-C 4.3%
  • Makefile 1.4%