//取源图像
Image imgPhoto = Image.FromFile(sSourceFile);
Bitmap bmPhoto = new Bitmap(imgPhoto.Width, imgPhoto.Height, PixelFormat.Format24bppRgb);
bmPhoto.MakeTransparent();
//设置绘图面属性,呈现质量等
Graphics grPhoto = Graphics.FromImage(bmPhoto);
grPhoto.SmoothingMode = SmoothingMode.AntiAlias;
grPhoto.DrawImage( imgPhoto, new Rectangle(0, 0, imgPhoto.Width, imgPhoto.Height), 0, 0, imgPhoto.Width, mgPhoto.Height, GraphicsUnit.Pixel);
//打开要附加的水印图片
Image imgWatermark = new Bitmap(sWatermarkFile);
Bitmap bmWatermark = new Bitmap(bmPhoto);
bmWatermark.SetResolution(imgPhoto.HorizontalResolution, imgPhoto.VerticalResolution);
Graphics grWatermark = Graphics.FromImage(bmWatermark);
int xPosOfWm = imgPhoto.Width - imgWatermark.Width;
int yPosOfWm = imgPhoto.Height - imgWatermark.Height;
//画
grWatermark.DrawImage(imgWatermark,
new Rectangle(xPosOfWm,yPosOfWm,imgWatermark.Width,imgWatermark.Height),
0,
0,
imgWatermark.Width,
imgWatermark.Height,
GraphicsUnit.Pixel);
//保存最终图片
imgPhoto = bmWatermark;
imgPhoto.Save(sIconFileName,ImageFormat.Png);