new MemoryStream()
using System; using System.IO; using System.Drawing; using System.Drawing.Imaging; public class Analyzer { public static void Main() { Image sample = new Bitmap("a.jpg"); MemoryStream buf = new MemoryStream(); sample.Save(buf, ImageFormat.Bmp); byte[] currentImage = buf.GetBuffer(); int[] stats = new int[3]; for (int i = 0; i < currentImage.Length; ){ for (int j = 0; j < 3; j++) { stats[j] += currentImage[i]; ++i; } } Console.WriteLine("Blue: " + stats[0]); Console.WriteLine("Green: " + stats[1]); Console.WriteLine("Red: " + stats[2]); if ((stats[0] > stats[1]) && (stats[0] > stats[2])) Console.WriteLine("This is a cold picture."); if ((stats[1] > stats[0]) && (stats[1] > stats[2])) Console.WriteLine("This is a summer picture."); if ((stats[2] > stats[0]) && (stats[2] > stats[1])) Console.WriteLine("This is a fiery picture."); } }