110,538
社区成员
发帖
与我相关
我的任务
分享
//Bitmap bm = (Bitmap)Image.FromFile(@"Pic/WEB Study.jpg");
//Bitmap bSp = bm.Clone(new System.Drawing.Rectangle(0, 0, 1, 1), bm.PixelFormat);
//bSp.Save(@"MyCutPicturesExport/WEB Study.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
Rectangle rect = row[colIndex];
Bitmap cutBitmap = pic.Clone(rect, pic.PixelFormat);
监视器下的对象数据:
pic.Width 1000 int
pic.Height 634 int
pic.PixelFormat Format24bppRgb System.Drawing.Imaging.PixelFormat
+ rect {X = 0 Y = 0 Width = 20 Height = 20} System.Drawing.Rectangle
using (Bitmap bmp = new Bitmap(width, height, PixelFormat.Format24bppRgb))
{
bmp.SetResolution(imageFrom.HorizontalResolution, imageFrom.VerticalResolution);
using (Graphics g = Graphics.FromImage(bmp))
{
// 用白色清空
g.Clear(Color.White);
// 指定高质量的双三次插值法。执行预筛选以确保高质量的收缩。此模式可产生质量最高的转换图像。
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
// 指定高质量、低速度呈现。
g.SmoothingMode = SmoothingMode.HighQuality;
// 在指定位置并且按指定大小绘制指定的 Image 的指定部分。
g.DrawImage(imageFrom, new Rectangle(X, Y, width, height), new Rectangle(0, 0, imageFromWidth, imageFromHeight), GraphicsUnit.Pixel);
}
}