Last post Mar 18, 2011 06:05 AM by albertxx
Member
71 Points
151 Posts
Mar 18, 2011 05:49 AM|albertxx|LINK
Hi everybody. I want to merge image(image format png)I use this code
string strImagePath1 = Server.MapPath("es00.png"); string strImagePath2 = Server.MapPath("es01.png"); Image firstImage = Image.FromFile(strImagePath1); Graphics objGraphics = Graphics.FromImage(firstImage); Image secondImage = Image.FromFile(strImagePath2); int iFirstImageWidth = firstImage.Width; int iFirstImageHeight = firstImage.Height; int iSecondImageWidth = secondImage.Width; int iSecondImageHeight = secondImage.Height; int xPos = (iFirstImageWidth - iSecondImageWidth) / 2; int yPos = (iFirstImageHeight - iSecondImageHeight ) / 2; objGraphics.DrawImage(secondImage, new Point(xPos, yPos)); Response.ContentType = "image/PNG"; firstImage.Save(Server.MapPath("MergeImage1.png"), ImageFormat.Png);
But How can I merge 7pictures to use this code?
Best Regards
Mar 18, 2011 06:05 AM|albertxx|LINK
I use this code. I fix it. Thanks again
string strImagePath = Server.MapPath("es.png"); string strImagePath1 = Server.MapPath("es00.png"); string strImagePath2 = Server.MapPath("es01.png"); string strImagePath3 = Server.MapPath("es02.png"); string strImagePath4 = Server.MapPath("es03.png"); string strImagePath5 = Server.MapPath("es04.png"); string strImagePath6 = Server.MapPath("es05.png"); string strImagePath7 = Server.MapPath("es06k0.png"); Image img = Image.FromFile(strImagePath); Graphics g = Graphics.FromImage(img); g.DrawImage(Image.FromFile(strImagePath1), new Point(0, 0)); g.DrawImage(Image.FromFile(strImagePath2), new Point(0, 0)); g.DrawImage(Image.FromFile(strImagePath3), new Point(0, 0)); g.DrawImage(Image.FromFile(strImagePath4), new Point(0, 0)); g.DrawImage(Image.FromFile(strImagePath5), new Point(0, 0)); g.DrawImage(Image.FromFile(strImagePath6), new Point(0, 0)); g.DrawImage(Image.FromFile(strImagePath7), new Point(0, 0)); img.Save(Server.MapPath("MergeImage1.png"), ImageFormat.Png); Response.ContentType = "image/PNG";
Member
71 Points
151 Posts
Merge Image
Mar 18, 2011 05:49 AM|albertxx|LINK
Hi everybody. I want to merge image(image format png)I use this code
But How can I merge 7pictures to use this code?
Best Regards
Member
71 Points
151 Posts
Re: Merge Image
Mar 18, 2011 06:05 AM|albertxx|LINK
I use this code. I fix it. Thanks again