org.hd.d.pg2k.svrCore.MIME
Class Quantize
java.lang.Object
org.hd.d.pg2k.svrCore.MIME.Quantize
public class Quantize
- extends java.lang.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
|
Nested Class Summary |
(package private) static class |
Quantize.Cube
|
|
Field Summary |
(package private) static int |
MAX_NODES
|
(package private) static int |
MAX_RGB
|
(package private) static int |
MAX_TREE_DEPTH
|
(package private) static boolean |
QUICK
|
(package private) static int[] |
SHIFT
|
(package private) static int[] |
SQUARES
|
|
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 |
QUICK
static final boolean QUICK
- See Also:
- Constant Field Values
MAX_RGB
static final int MAX_RGB
- See Also:
- Constant Field Values
MAX_NODES
static final int MAX_NODES
- See Also:
- Constant Field Values
MAX_TREE_DEPTH
static final int MAX_TREE_DEPTH
- See Also:
- Constant Field Values
SQUARES
static int[] SQUARES
SHIFT
static int[] SHIFT
Quantize
public Quantize()
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.
Copyright (c) 1996-2011, Damon Hart-Davis. All rights reserved.