/// <summary> /// do picture watermark (Drawing,io) /// </summary> /// <param name= "InPath" > Enter picture template path </param> /// <param name= "Outpath" > Enter picture path </param> /// <param name= "Onestr" > 1th line Text </param> /// <param name= "Onescript" >1-fonts </param> /// <param Name= "onesize" >1-font size </param> /// <param name= "OneX" >1-x coordinates < /param> /// <param name= "Oney" >1-y coordinates </param> /// <param name= "Twostr" > 2nd line text </param> /// <param name= "Twoscript" >2-font </param> /// <param name= "TwoSize" > 2-Font Size </PARAM>&NBSP; /// <param name= "Twox" >2-x coordinates </param> /// <param name= "Twoy" >2-y coordinates </param> private void Mygraphics (String inpath, string outpath, string onestr, string onescript, int oneSize, int oneX, int oneY, string twoStr, string Twoscript, int twosize, int twox, int twoy) { string one = oneStr; string two = twostr; memorystream ms = new memorystream (); bitmap bmp = new bitmap (Server.MapPath (Inpath)); graphics g = graphics.fromimagE (BMP); g.drawstring (One, new font (oneScript, Onesize), brushes.white, new point (Onex, oney)); g.drawstring (Two, new font (twoscript, twosize), brushes.white, new point ( Twox, twoy)); bmp. Save (ms, system.drawing.imaging.imageformat.jpeg); System.drawing.image i = system.drawing.image.fromstream (MS); i.save (Outpath); g.dispose (); bmp. Dispose (); }
This article is from the "Program Ape's Home" blog, please be sure to keep this source http://962410314.blog.51cto.com/7563109/1435290