8

I want to add a small, kind of fading out watermark image to all my images.

is there a way to do this in c#?

mrblah
  • 99,669
  • 140
  • 310
  • 420
  • 1
    [This open-source module](http://imageresizingin.net) can apply watermarks dynamically through ASP.NET, as well as by command (from a Windows Forms, console, or ASP.NET app). – Lilith River Apr 25 '11 at 09:39

1 Answers1

1

You can compose images using 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);

Just make sure to dispose all resources used as System.Drawing uses unmanaged GDI+ resources

mkeil
  • 134
  • 6