图片的大小和像素都不一样,加水印后的后果非常不理想,有的水印字体很小,而有的非常大,根本就显示不完,请问怎么解决,以下是我加水印的代码:
private void AddWater(string Source, string Dest, string addText)
{
System.Drawing.Image image = System.Drawing.Image.FromFile(Source);
System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(image);
g.DrawImage(image, 0, 0, image.Width, image.Height);
System.Drawing.Font f = new System.Drawing.Font( "Verdana ",60);
System.Drawing.Brush b = new System.Drawing.SolidBrush(System.Drawing.Color.Red);
g.DrawString(addText, f, b, 0, 0);
g.Dispose();
image.Save(Dest);
image.Dispose();
}
------解决方案--------------------------------------------------------
http://www.codeproject.com/csharp/watermark.asp
这有个处理的图片质量还行;。
------解决方案--------------------------------------------------------
正在看楼上提供的网站
------解决方案--------------------------------------------------------
学习飘过帮楼主顶顶顺便学习下
------解决方案--------------------------------------------------------
mark
------解决方案--------------------------------------------------------
maybe you can construct a new algorithm to implement the functionality that the text 's size is changed according to the size of the image and other referring info.
Good luck.
------解决方案--------------------------------------------------------
http://www.51aspx.com/CV/ImageUpload/
==============
看看这个
------解决方案--------------------------------------------------------
mark
------解决方案--------------------------------------------------------
帮你顶
------解决方案--------------------------------------------------------
http://www.wave12.com/web/home.asp
缩略图水印组件wsImage3.5
------解决方案--------------------------------------------------------
学习学习
------解决方案--------------------------------------------------------
学习!
------解决方案--------------------------------------------------------
以后看看
------解决方案--------------------------------------------------------
System.Drawing.Font f = new System.Drawing.Font( "Verdana ",60); //不要定死水印字体的大小啊,可以根据图片的大小来判断要打上多少大小的字体,如果图片很大,可以大一点,而如果很小的话,可以适当的小一点
int temp = image.Width > image.Height ? image.Height : image.Width;
if (temp > 500)
font = new Font( "Verdana ", 100);
else if (temp < 100)
font = new Font( "Verdana ", 50);
else
font = new Font( "Verdana ", 75);
------解决方案--------------------------------------------------------
路过一下
------解决方案--------------------------------------------------------
我也觉得也只有JGood() 说的这样咯
------解决方案--------------------------------------------------------
JGood() up
JF
------解决方案--------------------------------------------------------
System.Drawing.Font f = new System.Drawing.Font( "Verdana ",60);
60太绝对了,应根据情况定义值
------解决方案--------------------------------------------------------