Enum PaletteMiningMethod
Enum PaletteMiningMethod
Nom dels espais: Aspose.Imaging Assemblea: Aspose.Imaging.dll (25.4.0)
El mètode de mineria d’imatge paleta
public enum PaletteMiningMethod
Fields
ColorClustering = 1
El mètode de clusteratge de colors
Histogram = 2
El mètode histogràfic
UseCurrentPalette = 0
Utilitza la paleta existent de la imatge
Examples
L’exemple següent mostra com comprimir una imatge PNG, utilitzant el color indexat amb la millor paleta
// Loads png image
string sourceFilePath="OriginalRings.png";
string outputFilePath="OriginalRingsOutput.png";
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(sourceFilePath))
{
image.Save(outputFilePath, new Aspose.Imaging.ImageOptions.PngOptions()
{
Progressive = true,
// Use indexed color type
ColorType = Aspose.Imaging.FileFormats.Png.PngColorType.IndexedColor,
// Use maximal compression
CompressionLevel = 9,
// Get the closest 8-bit color palette which covers as many pixels as possible, so that a palettized image
// is almost visually indistinguishable from a non-palletized one.
Palette = Aspose.Imaging.ColorPaletteHelper.GetCloseImagePalette((Aspose.Imaging.RasterImage)image, 256, Aspose.Imaging.PaletteMiningMethod.Histogram)
});
}
// The output file size should be significantly reduced