Enum DitheringMethod
Enum DitheringMethod
Namespace: Aspose.Imaging
Assembly: Aspose.Imaging.dll (25.2.0)
วิธีการ dithering.
public enum DitheringMethod
ฟิลด์
FloydSteinbergDithering = 1
การ dithering แบบ Floyd-Steinberg เป็นอัลกอริธึม dithering ที่ซับซ้อนมากขึ้น ใช้ค่าอินทัสซิตี้จากเพื่อนบ้านที่ใกล้ที่สุด
ThresholdDithering = 0
การ dithering แบบ Threshold เป็นอัลกอริธึม dithering ที่ง่ายที่สุดและรวดเร็วที่สุด
ตัวอย่าง
ตัวอย่างต่อไปนี้โหลดภาพแบบแรสเตอร์และทำการ dithering แบบ threshold และ floyd โดยใช้ความลึกของพาเลตที่แตกต่างกัน.```csharp [C#]
string dir = "c:\\temp\\";
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.png"))
{
Aspose.Imaging.RasterImage rasterImage = (Aspose.Imaging.RasterImage)image;
// ทำการ dithering แบบ threshold โดยใช้พาเลตสี 4 บิตที่มีสี 16 สี.
// ยิ่งระบุบิตมากขึ้น คุณภาพจะสูงขึ้นและขนาดของภาพเอาต์พุตจะใหญ่ขึ้น.
// โปรดทราบว่าขณะนี้รองรับเฉพาะพาเลต 1 บิต, 4 บิต และ 8 บิตเท่านั้น.
rasterImage.Dither(Aspose.Imaging.DitheringMethod.ThresholdDithering, 4);
rasterImage.Save(dir + "sample.ThresholdDithering4.png");
}
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.png"))
{
Aspose.Imaging.RasterImage rasterImage = (Aspose.Imaging.RasterImage)image;
// ทำการ dithering แบบ floyd โดยใช้พาเลตสี 1 บิตที่มีเพียง 2 สี - ขาวและดำ.
// ยิ่งระบุบิตมากขึ้น คุณภาพจะสูงขึ้นและขนาดของภาพเอาต์พุตจะใหญ่ขึ้น.
// โปรดทราบว่าขณะนี้รองรับเฉพาะพาเลต 1 บิต, 4 บิต และ 8 บิตเท่านั้น.
rasterImage.Dither(Aspose.Imaging.DitheringMethod.FloydSteinbergDithering, 1);
rasterImage.Save(dir + "sample.FloydSteinbergDithering1.png");
}