C# 藉助bitmap進行RGB顏色比對
阿新 • • 發佈:2019-01-09
public static bool IsBlankImage(byte[] imageData) { //some image color :#C49A6A, rgb(196,154,106) var colorBlank = Color.FromArgb(196, 154, 106); using (var ms = new MemoryStream(imageData)) { var image = Image.FromStream(ms); var bmp = new Bitmap(image); var color1 = bmp.GetPixel(0, 1); var color2 = bmp.GetPixel(bmp.Width / 2, bmp.Height / 2); var color3 = bmp.GetPixel(bmp.Width / 4, bmp.Height / 4); if (color1 == colorBlank && color2 == colorBlank && color3 == colorBlank) { return false; } return true; } }