-3
我有一個視圖,我顯示的圖像列表中的滑塊每一件事情都完成了,但想要編碼時,用戶選擇兩個圖像的控制器應該合併圖像彼此,也執行一些text.well是否有可能在Jquery中複製兩個div並將它們轉換爲圖像併發送給控制器。Asp.net mvc 4合併兩個圖像
任何例子 C# jQuery,請讓我知道
[HttpPost]
public ActionResult Index(HttpPostedFileBase Imageone, HttpPostedFileBase Imagetwo)
{
return View();
}
public static System.IO.MemoryStream CombineImages(byte[] imageBytes1, byte[] imageBytes2)
{
if ((imageBytes1 == null || imageBytes1.Length == 0) ||
(imageBytes2 == null || imageBytes2.Length == 0))
return null;
//convert bytes to Image
var image1 = System.Drawing.Image.FromStream(new System.IO.MemoryStream(imageBytes1));
var image2 = System.Drawing.Image.FromStream(new System.IO.MemoryStream(imageBytes2));
//create the Bitmap object
var bitmap = new System.Drawing.Bitmap(image1.Width, image1.Height, PixelFormat.Format32bppPArgb);
//create the Graphics object
var g = System.Drawing.Graphics.FromImage(bitmap);
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.High;
g.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality;
g.DrawImage(image1, 0, 0);
g.DrawImage(image2, 0, 0);
var ms = new System.IO.MemoryStream(bitmap.Width * bitmap.Height);
bitmap.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
return ms;
}