Enum PaletteMiningMethod
Enum PaletteMiningMethod
Tên không gian: Aspose.Imaging Tổng hợp: Aspose.Imaging.dll (25.4.0)
Phương pháp khai thác hình ảnh palette
public enum PaletteMiningMethod
Fields
ColorClustering = 1
Phương pháp cluster màu
Histogram = 2
Phương pháp histogram
UseCurrentPalette = 0
Sử dụng palette tồn tại của hình ảnh
Examples
Ví dụ sau đây cho thấy làm thế nào để nén một hình ảnh PNG, sử dụng màu indexed với tốt nhất phù hợp palette
// 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