当前位置:网站首页>. net background upload pictures without saving pictures to compress pictures
. net background upload pictures without saving pictures to compress pictures
2022-04-22 19:24:00 【Pingshan CP3】
Before compressing pictures in the background, we always save the pictures to the server first , Then compress the picture ; Now you can avoid saving pictures in advance by file streaming , Make a note of
Specific code
var file= Request.Form.Files[0];
Image image = System.Drawing.Image.FromStream(file.OpenReadStream());
Bitmap bmpCut = new Bitmap(512, 377, PixelFormat.Format24bppRgb);
Graphics g = Graphics.FromImage(bmpCut);
g.DrawImage(image, new Rectangle(0, 0, 512, 377), new Rectangle(0, 0, image.Width, image.Height), GraphicsUnit.Pixel);
g.Dispose();
image.Dispose();
Image.FromStream Method : Create from the specified data stream Image.
IFormFile.OpenReadStream: Open the request stream to read the uploaded file
版权声明
本文为[Pingshan CP3]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204221922241715.html
边栏推荐
- 14-Sprak设置自动分区
- linux 下mysql 5.6的一些操作
- [appium stepping on the pit] could not proxy command to the remote server Original error: timeout of 240000ms exceeded
- 【Appium踩坑】Failed to capture a screenshot. Does the current view have ‘secure‘ flag set?
- 7.数据中台 --- 数据开发:数据体系建设
- 14 sprak set automatic zoning
- Arithmetic overflow error converting IDENTITY to data type int(SqlServer主键自增长引起的问题)
- [early spring 2022] [leetcode] 695 Maximum area of the island
- Recursive data query of tree structure in a table in SQL Server
- MYSQL,组合的唯一索引中,处理NULL值的问题
猜你喜欢
随机推荐
webrtc+turn+peerconnection_server测延时
代码中的位运算
如何保证缓存与数据库的一致性?
Static dispatch and dynamic dispatch
Configure interceptor not to intercept swagger
06. 重构-简化条件表达式
【2022初春】【LeetCode】695. 岛屿的最大面积
静态分派和动态分派
09-Partitioning
项目实训- 基于unity的2D多人乱斗闯关游戏设计与开发(小地图修改完善)
656 · 大整数乘法
MySQL排错信息查询(持续更新)
10.4.4 51单片机控制系统8个LED“跑马灯”实验
阿里云安装 ffmpeg
[appium stepping pit] failed to capture a screenshot Does the current view have ‘secure‘ flag set?
(3) MySQL constraints
.net core minimal api 上传文件
Project training - Design and development of 2D multiplayer scuffle game based on unity (III. unity plasticscm multiplayer collaboration)
数据库连接池HikariCP中的FastList快在哪里
时间日期格式化









