// 示例方法 不进行单元测试 public void BitmapHandlerTest() { var bitmap = System.Drawing.Bitmap.FromStream(new MemoryStream()) .ToBytes(System.Drawing.Imaging.ImageFormat.Bmp).ToBitmap(); var bitmapHanddler = new BitmapHandler(bitmap); bitmapHanddler.ResizeImage(100, 100); bitmap = bitmapHanddler.Cut(0, 0, 100, 100); bitmapHanddler = bitmapHanddler .GrayByPixels() .ClearPicBorder(1) .GrayByLine() .GetPicValidByValue(0) .GetPicValidByValue(0, 1); bitmap = bitmapHanddler.GetPicValidByValue(bitmap, 0); var bitmaps = bitmapHanddler.GetSplitPics(2, 2); var str = bitmapHanddler.GetSingleBmpCode(bitmap, 0); }