Upload | upload image ASP. NET upload picture, want to add watermark. For example, the URL . text is white. But when the background is white, watermark can not see . everywhere search data, find the way to draw text shadow . find several, finally find a foreigner's article, and. NET with the same story as in the document . is actually the first to draw 2-5 alpha values of different gray text when the shadow. On top, draw the normal color text .... Sweat!!!!!!!!!!!!!!!!!! 111 There is no way, but will be used. The effect is also general. font font=new font ("Arial black", 15,fontstyle.bold); Sizef sf=g.measurestring ("imggood.com", font); pointf pf=new pointf (); pf. X= (250-SF. Width)/2; pf. Y= (bheight-sf.height)/2; //creates a new watermark Bmp bitmap floatbmp=new bitmap (int) sf. Width+3, (int) sf. HEIGHT+3,SYSTEM.DRAWING.IMAGING.PIXELFORMAT.FORMAT32BPPARGB); //bitmap floatbmp=new bitmap ( 250,100); //bitmap floatbmp=new bitmap ((int) sf. Width, (int) sf. Height); graphics fg=graphics.fromimage (floatbmp); //painted Shadow characters pointf pt=new pointf (0,0); system.drawing.brush transparentbrush0 = new system.drawing.solidbrush ( System.Drawing.Color.FromArgb (50,system.drawing.color.black ) ) ; System.Drawing.Brush TransparentBrush1 = new System.Drawing.SolidBrush ( system.drawing.color.fromargb (20,system.drawing.color.black ) )  ; FG. DrawString ("imggood.com", font,transparentbrush0,pt. X,pt. y+1); fg. DrawString ("imggood.com", font,transparentbrush0,pt. X+1,pt. Y); fg. DrawString ("imggood.com", font,transparentbrush1,pt. X+1,pt. y+1); fg. DrawString ("imggood.com", font,transparentbrush1,pt. X,pt. y+2); fg. DrawString ("imggood.com", font,transparentbrush1,pt. X+2,pt. Y); transparentbrush0.dispose (); transparentbrush1.dispose (); //Draw logo character fg. SMOOTHINGMODE=SYSTEM.DRAWING.DRAWING2D.SMOOTHINGMODE.HIGHQUALITY; //FG. Clear (Color.Black); fg. DrawString ("Imggood.com", Font,new solidbrush (Color.White), Pt. X,pt. Y,stringformat.genericdefault); //painting watermark to large map fg. Save (); fg. Dispose (); //set the color properties of the transparent image  FLOAT[][] PTSARRAY ={ NEW FLOAT[] {1,&Nbsp;0, 0, 0, 0}, new float[] {0, 1, 0, 0, 0}, new float[] {0, 0, 1, 0, 0}, new float[] {0, 0, 0, 0.5f, 0}, new float[] {0, 0, 0, 0, 1}}; colormatrix clrmatrix = new colormatrix (Ptsarray); imageattributes imgattributes = new ImageAttributes (); imgattributes.setcolormatrix (Clrmatrix, colormatrixflag.default, COLORADJUSTTYPE.BITMAP); g.drawimage (Floatbmp,new rectangle (10,10, (int) sf. Width, (int) sf. Height), 0,0, (int) sf. Width, (int) sf. height,graphicsunit.pixel,imgattributes); //============================================================= =========== g.save (); g.dispose (); bigbmp.save (filepath + "B" + fileName); bigbmp.dispose (); code is not difficult, does not solve the
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.