CSharp examples for System.Drawing:Bitmap
Colors from Bitmap
using System.Drawing.Imaging; using System.Drawing; using System.Text; using System.Linq; using System.Collections.Generic; using System;//from ww w .ja v a2s .co m public class Main{ static public IEnumerable<Color> Colors(this Bitmap Bitmap) { int Width = Bitmap.Width, Height = Bitmap.Height; for (int y = 0; y < Height; y++) { for (int x = 0; x < Width; x++) { yield return Bitmap.GetPixel(x, y); } } } }