2011-03-24 92 views
0

我想要一个能够为图像添加柔和边框的.net(或本机)代码。.net图像编辑算法

例如:

初始图像

改造后

http://www.pictureshack.us/images/4201kennedyNorm.png

图片:

http://www.pictureshack.us/images/4451kennedySoft.png

我用Word 2010中做到了,但我相信有一个C++或者.net lib执行相同的操作。

如果您熟悉一些可以做到这一点的代码,请告诉我。

谢谢。

+0

你想淡入颜色(如白色),或使用alpha通道? – Justin 2011-03-24 19:22:44

+0

Alpha通道更好,但白色也可以。 – 2011-03-24 19:24:00

+0

你不从头开始。下载GIMP并用脚本fu编程。看到这里:http://pingus.seul.org/~grumbel/gimp/script-fu/script-fu-tut.html – schoetbi 2011-03-24 19:25:57

回答

1

最简单的方法是创建一个从变淡白色到透明的图像,以及刚刚绘制的图像的顶部。像:

using (Bitmap b = (Bitmap)Image.FromFile("frame.png")) { 
    using (Graphics g = Graphics.FromImage(theImage)) { 
    g.DrawImage(b, 0, 0, theImage.Width, theImage.Height); 
    } 
}