Add an Image control to the ASPX page, which imageurl= "image.aspx", adding a image.aspx that is specifically designed to
working with Images, write the following code in the Page_Load event handling in CS code:
Original image
String physicalpath = Server.MapPath ("./129519.jpg");
System.Drawing.Image Srcbitmap = Bitmap.fromfile (PhysicalPath);
Desired target Image
int outheight = Srcbitmap.height * 2;
int outwidth = Srcbitmap.width * 2;
First, create a blank bitmap
Bitmap Outbitmap = new Bitmap (Outwidth, Outheight, Pixelformat.format24bpprgb);
Graphics g = graphics.fromimage (Outbitmap);
Drawing on the Outbitmap
Rectangle destrectangle=new Rectangle (0, 0, outwidth, outheight);
int SRCX = 0;
int Srcy = 0;
G.drawimage (Srcbitmap, destrectangle/* shows the size of the image */, srcx,srcy/* from this x, Y coordinates to intercept the */,srcbitmap.width/4/* intercept width */, srcbitmap.height/4/* Interception High */, GraphicsUnit.Pixel);
Setting the output type
Response.ContentType = "Image/jpeg";
Output to Client
Outbitmap.save (Response.outputstream, imageformat.jpeg);
Response.End ();