How can I generate a palette of prominent colors from an image?

后端 未结 6 2138
被撕碎了的回忆
被撕碎了的回忆 2020-12-23 14:57

I\'m trying to figure out how to sample all of the pixels in an image and generate a palette of colors from it, something like this or this. I have no idea where to even beg

6条回答
  •  时光取名叫无心
    2020-12-23 15:42

    I started here:

    System.Drawing.Image img = System.Drawing.Bitmap.FromFile("file");
    System.Drawing.Imaging.ColorPalette palette = img.Palette;
    foreach (Color color in palette.Entries)
    {
      //...
    }
    

提交回复
热议问题