cropper .net后台截图
来源:互联网 发布:mac office 登陆 编辑:程序博客网 时间:2024/04/29 08:41
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; var files = context.Request.Files[0]; int x = (int)Convert.ToDouble(context.Request["name"].Split(',')[0].Split(':')[1]); int y = (int)Convert.ToDouble(context.Request["name"].Split(',')[1].Split(':')[1]); int w = (int)Convert.ToDouble(context.Request["name"].Split(',')[2].Split(':')[1]); int h = (int)Convert.ToDouble(context.Request["name"].Split(',')[3].Split(':')[1]); Stream sm = files.InputStream; byte[] bt = new byte[sm.Length]; sm.Read(bt, 0, files.ContentLength); System.Drawing.Image bm = System.Drawing.Image.FromStream(CropImageFile(bt, x, y, w, h), true); bm.Save(context.Request.PhysicalApplicationPath + "upload\\" + files.FileName); bm.Dispose(); context.Response.Write("Hello World"); } //裁剪 protected MemoryStream CropImageFile(byte[] imageFile, int targetX, int targetY, int targetW, int targetH) { MemoryStream imgMemoryStream = new MemoryStream(); System.Drawing.Image imgPhoto = System.Drawing.Image.FromStream(new MemoryStream(imageFile)); Bitmap bmPhoto = new Bitmap(targetW, targetH, System.Drawing.Imaging.PixelFormat.Format24bppRgb); bmPhoto.SetResolution(72, 72); Graphics grPhoto = Graphics.FromImage(bmPhoto); grPhoto.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; grPhoto.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic; grPhoto.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality; try { grPhoto.DrawImage(imgPhoto, new Rectangle(0, 0, targetW, targetH), targetX, targetY, targetW, targetH, GraphicsUnit.Pixel); bmPhoto.Save(imgMemoryStream, System.Drawing.Imaging.ImageFormat.Png); } catch (Exception e) { throw e; } finally { imgPhoto.Dispose(); bmPhoto.Dispose(); grPhoto.Dispose(); } return imgMemoryStream; }
0 0
- cropper .net后台截图
- net后台对视频进行截图
- cropper
- cropper
- 后台截图
- javaweb 项目 使用image cropper jquery插件 截图上传
- 网站后台截图
- [VC++]后台截图
- DX后台截图
- 后台截图(一)
- 后台截图(二)
- 后台截图(三)
- 后台截图(四)
- 后台截图(五)
- 后台截图(六)
- Android 后台截图
- cropper配合ajaxupload实现图片截图与上传并上传至远程服务器地址
- ASP.NET MVC5+EF6+EasyUI 后台管理系统--工作流演示截图
- 不用库函数 求解立方根
- K-NN算法
- ios 仿知乎手势滑动效果
- 困扰我国3D打印发展的常见问题解读
- 借助Apache Cordova构建混合移动应用程序
- cropper .net后台截图
- 对于多对一关联的时候使用JSON方式显示不出来的问题
- HDU 4305 Lightning (判断点在线段上,生成树计数)
- 用FDM打印会遇到的3D打印常见问题详解
- MySQL执行计划解读
- Unity3D教程宝典之两步实现超实用的XML存档
- hive部署
- 计算两个字符串的最长公共字串长度(java编程)
- flume采集的一些特性