码迷,mamicode.com
首页 > Web开发 > 详细

.net图片快速去底(去除白色背景)

时间:2014-12-22 16:11:08      阅读:146      评论:0      收藏:0      [点我收藏+]

标签:

 public System.Drawing.Bitmap KnockOutGzf(String path)
        {
            System.Drawing.Image image = System.Drawing.Image.FromFile(path);
            System.Drawing.Bitmap bitmapProxy = new System.Drawing.Bitmap(image);
            image.Dispose();
            for (int i = 0; i < bitmapProxy.Width; i++)
            {
                for (int j = 0; j < bitmapProxy.Height; j++)
                {
                    System.Drawing.Color c = bitmapProxy.GetPixel(i, j);
                    if (!(c.R < 240 || c.G < 240 || c.B < 240))
                    {
                        bitmapProxy.SetPixel(i, j, System.Drawing.Color.Transparent);
                    }
                }
            }
            return bitmapProxy;
        }

  

.net图片快速去底(去除白色背景)

标签:

原文地址:http://www.cnblogs.com/guozefeng/p/4178291.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!