2011-03-24 88 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); 
    } 
}