我想在所有的图片上添加一个小的、渐隐的水印图像。请问在C#中有什么方法可以做到这一点?
您可以使用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+资源。