using System; using System.Collections.Generic; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Chrosey.Extensions { public static class ImageExtensions { /// /// Gibt eine Liste an Farben zurück, die für ein Quantisierungsverfahren geeignet sind. /// /// /// public static List Pixels(this Bitmap bitmap, int quality) { var pixels = new List(); var count = 0; for (int x = 0; x < bitmap.Width; x++) { for (int y = 0; y < bitmap.Height; y++) { if (count % quality == 0) { count = 0; var p = bitmap.GetPixel(x, y); if (p.A >= 125) { if (!(p.R > 250 && p.G > 250 && p.B > 250)) { pixels.Add(p.SignificantColor()); } } } count++; } } return pixels; } } }