首页 > Web开发 > 详细

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

时间:2014-12-22 16:08:02      阅读:241      评论: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
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!