In fact, the use of C # to manipulate the stitching of the picture is to use graphic drawing. Personal feeling is very interesting, various types of library provides a variety of functions.
Source code (ported to a simple C # program that is not placed in an ASP. NET project):
usingSystem.Drawing;usingSystem.Drawing.Drawing2D;usingSystem.Drawing.Imaging;namespacetest{classProgram {Static voidMain (string[] args) {Image img=NewBitmap (NewBitmap ("Model1.png"), -, the);//Loading PicturesGraphics g = Graphics.fromimage (IMG);//convert pictures to graphicsG.smoothingmode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;//Plus anti-aliasing effect//point[] DestPoints1 = { NewPoint (453, the),//top left point of the picture NewPoint (638, +),//top right point of the picture NewPoint (497,212),//picture lower left Dot }; G.drawimage (NewBitmap ("img1.jpg"), destPoints1);//draw by the specified vertexG.drawlines (NewPen (Brushes.gray),Newpoint[] {NewPoint (453, the), NewPoint (638, +), NewPoint (683,144), NewPoint (497,212), NewPoint (453, the), });//draw lines that depict the boundaries of IMG1 picturespoint[] DestPoints2= { NewPoint ( -,158), NewPoint (590,203), NewPoint (370,287) }; G.drawimage (NewBitmap ("img1.jpg"), destPoints2); G.drawlines (NewPen (Brushes.gray),Newpoint[] {NewPoint ( -,158), NewPoint (590,203), NewPoint (559,332), NewPoint (370,287), NewPoint ( -,158), }); G.fillrectangle (Brushes.gray,525,279,201,135);//Draw a rectangleG.drawimage (NewBitmap ("img1.jpg"),526,280,199,133);//draw directly by the specified length and widthImg. Save ("Test1.png");//Save as PictureImg. Dispose ();//Show Free ResourcesG.dispose (); } }}
View Code
:
This knowledge sharing is here, please look forward to the next share. ^_^
< my blog homepage;:http://www.cnblogs.com/forcheng/
<wing Studio homepage;:http://www.wingstudio.org/
ASP. NET MVC Website Development Summary (vii)--c# operation Picture: mosaic of multiple graphs (rotation)