Table of Contents

Class ColorPaletteHelper

Namespace
Aspose.Imaging
Assembly
Aspose.Imaging.dll

Helper class for color palettes manipulation.

public static class ColorPaletteHelper
Inheritance
ColorPaletteHelper
Inherited Members

Methods

Create4Bit()

Creates the 4 bit color palette.

public static IColorPalette Create4Bit()

Returns

IColorPalette

The 4 bit color palette.

Create4BitGrayscale(bool)

Creates the 4 bit grayscale palette.

public static IColorPalette Create4BitGrayscale(bool minIsWhite)

Parameters

minIsWhite bool

if set to true the palette starts with white color, otherwise it starts with black color.

Returns

IColorPalette

The 4 bit grayscale palette.

Create8Bit()

Creates the 8 bit color palette.

public static IColorPalette Create8Bit()

Returns

IColorPalette

The 8 bit color palette.

Create8BitGrayscale(bool)

Creates the 8 bit grayscale palette.

public static IColorPalette Create8BitGrayscale(bool minIsWhite)

Parameters

minIsWhite bool

if set to true the palette starts with white color, otherwise it starts with black color.

Returns

IColorPalette

The 8 bit grayscale palette.

CreateMonochrome()

Creates a monochrome color palette containing 2 colors only.

public static IColorPalette CreateMonochrome()

Returns

IColorPalette

Color palette for monochrome images.

GetCloseImagePalette(RasterImage, Rectangle, int)

Gets color palette from raster image (palletizes image) in case the image does not have one. In case palette exists it will be used instead performing calculations.

public static IColorPalette GetCloseImagePalette(RasterImage image, Rectangle destBounds, int entriesCount)

Parameters

image RasterImage

The raster image.

destBounds Rectangle

The destination image bounds.

entriesCount int

The desired entries count.

Returns

IColorPalette

The color palette which starts with the most frequent colors from the image and contains entriesCount entries.

GetCloseImagePalette(RasterImage, Rectangle, int, bool)

Gets color palette from raster image (palletizes image) in case the image does not have one. In case palette exists it will be used instead performing calculations.

public static IColorPalette GetCloseImagePalette(RasterImage image, Rectangle destBounds, int entriesCount, bool useImagePalette)

Parameters

image RasterImage

The raster image.

destBounds Rectangle

The destination image bounds.

entriesCount int

The desired entries count.

useImagePalette bool

If set, it will use its own image palette if available

Returns

IColorPalette

The color palette which starts with the most frequent colors from the image and contains entriesCount entries.

GetCloseImagePalette(RasterImage, Rectangle, int, bool, Color)

Gets color palette from raster image (palletizes image) in case the image does not have one. In case palette exists it will be used instead performing calculations.

public static IColorPalette GetCloseImagePalette(RasterImage image, Rectangle destBounds, int entriesCount, bool useImagePalette, Color alphaBlendInColor)

Parameters

image RasterImage

The raster image.

destBounds Rectangle

The destination image bounds.

entriesCount int

The desired entries count.

useImagePalette bool

If set, it will use its own image palette if available

alphaBlendInColor Color

The color that should be used as a background color for semi-transparent alpha replacement.

Returns

IColorPalette

The color palette which starts with the most frequent colors from the image and contains entriesCount entries.

GetCloseImagePalette(RasterImage, Rectangle, int, bool, Color, bool)

Gets color palette from raster image (palletizes image) in case the image does not have one. In case palette exists it will be used instead performing calculations.

public static IColorPalette GetCloseImagePalette(RasterImage image, Rectangle destBounds, int entriesCount, bool useImagePalette, Color alphaBlendInColor, bool keepTransparency)

Parameters

image RasterImage

The raster image.

destBounds Rectangle

The destination image bounds.

entriesCount int

The desired entries count.

useImagePalette bool

If set, it will use its own image palette if available

alphaBlendInColor Color

The color that should be used as a background color for semi-transparent alpha replacement.

keepTransparency bool

If set, it will consider alpha channel bits of the image colors.

Returns

IColorPalette

The color palette which starts with the most frequent colors from the image and contains entriesCount entries.

GetCloseImagePalette(RasterImage, int)

Gets color palette from raster image (palletizes image) in case the image does not have one. In case palette exists it will be used instead performing calculations.

public static IColorPalette GetCloseImagePalette(RasterImage image, int entriesCount)

Parameters

image RasterImage

The raster image.

entriesCount int

The desired entries count.

Returns

IColorPalette

The color palette which starts with the most frequent colors from the image and contains entriesCount entries.

GetCloseImagePalette(RasterImage, int, PaletteMiningMethod)

Gets color palette from raster image (palletizes image) in case the image does not have one. Palette is about to be optimized for better indexed image quality or taken "AS IS" when PaletteMiningMethod.UseCurrentPalette is used.

public static IColorPalette GetCloseImagePalette(RasterImage image, int entriesCount, PaletteMiningMethod paletteMiningMethod)

Parameters

image RasterImage

The raster image.

entriesCount int

The desired entries count.

paletteMiningMethod PaletteMiningMethod

The palette mining method.

Returns

IColorPalette

The color palette which starts with the most frequent colors from the image and contains entriesCount entries.

GetCloseTransparentImagePalette(RasterImage, int)

Gets color palette from raster image (palletizes image) in case the image does not have one. In case palette exists it will be used instead performing calculations.

public static IColorPalette GetCloseTransparentImagePalette(RasterImage image, int entriesCount)

Parameters

image RasterImage

The raster image.

entriesCount int

The desired entries count.

Returns

IColorPalette

The color palette which starts with the most frequent colors from the image and contains entriesCount entries.

GetDownscalePalette(RasterImage)

Get 256 color palette, composed from upper bits of initial image color values.

public static ColorPalette GetDownscalePalette(RasterImage image)

Parameters

image RasterImage

The image.

Returns

ColorPalette

The ColorPalette.

GetUniformColorPalette(RasterImage)

Get uniform 256 color palette.

public static ColorPalette GetUniformColorPalette(RasterImage image)

Parameters

image RasterImage

The image.

Returns

ColorPalette

The ColorPalette.

HasTransparentColors(IColorPalette)

Determines whether the specified palette has transparent colors.

public static bool HasTransparentColors(IColorPalette palette)

Parameters

palette IColorPalette

The palette.

Returns

bool

true if the specified palette has transparent colors; otherwise, false.

Exceptions

ArgumentNullException

palette is null.