FreeHEP API
Version current

org.freehep.graphicsio.gif
Class Quantize

java.lang.Object
  extended byorg.freehep.graphicsio.gif.Quantize

public class Quantize
extends Object

An efficient color quantization algorithm, adapted from the C++ implementation quantize.c in ImageMagick. The pixels for an image are placed into an oct tree. The oct tree is reduced in size, and the pixels from the original image are reassigned to the nodes in the reduced tree.

Here is the copyright notice from ImageMagick:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%  Permission is hereby granted, free of charge, to any person obtaining a    %
%  copy of this software and associated documentation files ("ImageMagick"),  %
%  to deal in ImageMagick without restriction, including without limitation   %
%  the rights to use, copy, modify, merge, publish, distribute, sublicense,   %
%  and/or sell copies of ImageMagick, and to permit persons to whom the       %
%  ImageMagick is furnished to do so, subject to the following conditions:    %
%                                                                             %
%  The above copyright notice and this permission notice shall be included in %
%  all copies or substantial portions of ImageMagick.                         %
%                                                                             %
%  The software is provided "as is", without warranty of any kind, express or %
%  implied, including but not limited to the warranties of merchantability,   %
%  fitness for a particular purpose and noninfringement.  In no event shall   %
%  E. I. du Pont de Nemours and Company be liable for any claim, damages or   %
%  other liability, whether in an action of contract, tort or otherwise,      %
%  arising from, out of or in connection with ImageMagick or the use or other %
%  dealings in ImageMagick.                                                   %
%                                                                             %
%  Except as contained in this notice, the name of the E. I. du Pont de       %
%  Nemours and Company shall not be used in advertising or otherwise to       %
%  promote the sale, use or other dealings in ImageMagick without prior       %
%  written authorization from the E. I. du Pont de Nemours and Company.       %
%                                                                             %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Version:
0.90 19 Sep 2000
Author:
Adam Doppelt
Source Code:
Quantize.java

Constructor Summary
Quantize()
           
 
Method Summary
static int[] quantizeImage(int[][] pixels, int max_colors)
          Reduce the image to the given number of colors.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Quantize

public Quantize()
Method Detail

quantizeImage

public static int[] quantizeImage(int[][] pixels,
                                  int max_colors)
Reduce the image to the given number of colors. The pixels are reduced in place.

Returns:
The new color palette.

FreeHEP API
Version current

Copyright © 2000-2004 FreeHEP, All Rights Reserved.