为图像添加水印图片

8
我想在所有的图片上添加一个小的、渐隐的水印图像。请问在C#中有什么方法可以做到这一点?

1
这个开源模块可以通过ASP.NET动态地应用水印,也可以通过命令(从Windows Forms、控制台或ASP.NET应用程序)应用水印。 - Lilith River
1个回答

1

您可以使用System.Drawing来组合图像。

//1. create a bitmap (create a empty one or from file)
Bitmap bmpPic = new Bitmap(imgWidth,imgHeight);

//2. pass that bitmap into Graphics
using (Graphics g = Graphics.FromImage(bmpPic))
{
    //manipulate the image
}

//3. save the bitmap back to a filestream
bmpPic.Save(imgFileStream,ImageFormat.Png);

请确保处理所有使用的资源,因为System.Drawing使用非托管的GDI+资源。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接