NAME

Image::Quantize::PNG - quantize PNG image data into 256 or fewer colours

SYNOPSIS

use Image::PNG::Libpng ':all';
use Image::Quantize::PNG;
my $rgba = read_png_file ('rgba.png');
my $Q = Image::Quantize::PNG->new ();
my $palette = $Q->quantize ($rgba);
$palette->write_png_file ('palette.png');

DESCRIPTION

Image::Quantize reduces the number of colours used by a PNG image to 256 or less. The reduction in the number of colours, also known as "quantization" or "palettization", reduces the size of the image.

This only works on RGBA pngs at the moment. Work on handling RGB, greyscale, etc. is underway.

METHODS

See the documentation for Image::Quantize.

quantize

my $palette = $iq->quantize ($rgba);

quantize_file

$iq->quantize_file (in => 'rgba.png', out => 'palette.png');