PaletteMiningMethod

Inheritance: java.lang.Object, com.aspose.ms.System.ValueType, com.aspose.ms.System.Enum

public final class PaletteMiningMethod extends System.Enum

طريقة استخراج لوحة ألوان الصورة

الحقول

حقلالوصف
UseCurrentPaletteاستخدم لوحة الألوان الموجودة في الصورة
ColorClusteringطريقة تجميع الألوان
Histogramطريقة الرسم البياني

Example: The following example shows how to compress a PNG image, using indexed color with best fit palette


// يحمّل صورة PNG        
String sourceFilePath = "OriginalRings.png";
String outputFilePath = "OriginalRingsOutput.png";
try (com.aspose.imaging.Image image = com.aspose.imaging.Image.load(sourceFilePath))
{
    com.aspose.imaging.imageoptions.PngOptions options = new com.aspose.imaging.imageoptions.PngOptions();
    options.setProgressive(true);
    // استخدم نوع اللون المفهرس
    options.setColorType(com.aspose.imaging.fileformats.png.PngColorType.IndexedColor);
    // استخدم أقصى ضغط
    options.setCompressionLevel(9);
    // احصل على أقرب لوحة ألوان 8‑بت تغطي أكبر عدد ممكن من البكسلات، بحيث تكون الصورة الملوّنة باللوحة
    // تكاد تكون غير قابلة للتمييز بصريًا عن صورة غير ملوّنة باللوحة.
    options.setPalette(com.aspose.imaging.ColorPaletteHelper.getCloseImagePalette((com.aspose.imaging.RasterImage)image, 
                                256, Aspose.Imaging.PaletteMiningMethod.Histogram));
                     
    image.save(outputFilePath, options);
}
// يجب تقليل حجم ملف الإخراج بشكل كبير

UseCurrentPalette

public static final int UseCurrentPalette

استخدم لوحة الألوان الموجودة في الصورة

ColorClustering

public static final int ColorClustering

طريقة تجميع الألوان

Histogram

public static final int Histogram

طريقة الرسم البياني