212s
 public Bitmap ResizeImage(Bitmap bmp, int newW, int newH,int dpi)
        {
            var b = new Bitmap(newW, newH);
            b.SetResolution(dpi,dpi);//设置DPI

            var g = Graphics.FromImage(b);

            g.InterpolationMode = InterpolationMode.HighQualityBicubic;
            g.CompositingQuality = CompositingQuality.HighQuality;
            g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;
            g.DrawImage(bmp, new Rectangle(0, 0, newW, newH), new Rectangle(0, 0, bmp.Width, bmp.Height), GraphicsUnit.Pixel);

            g.Dispose();

            return b;
        }

 

分类:

技术点:

相关文章:

  • 2022-12-23
  • 2021-05-01
  • 2021-04-22
  • 2022-03-07
  • 2022-01-18
  • 2022-01-01
  • 2021-07-19
  • 2021-10-04
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-23
  • 2021-12-23
  • 2021-12-26
相关资源
相似解决方案