weiying

改变图片分辨率

/// <summary>
        /// 更改背景图片的分辨率
        /// </summary>
        /// <param name="bmp"></param>
        /// <param name="newW"></param>
        /// <param name="newH"></param>
        /// <returns></returns>
        private Bitmap ResizeImage(Image bmp, int newW, int newH)
        {
            try
            {
                Bitmap b = new Bitmap(newW, newH);
                Graphics g = Graphics.FromImage(b);
                // 插值算法的质量
                g.InterpolationMode = InterpolationMode.HighQualityBicubic;
                g.DrawImage(bmp, new Rectangle(0, 0, newW, newH), new Rectangle(0, 0, bmp.Width, bmp.Height), GraphicsUnit.Pixel);
                g.Dispose();
                return b;
            }
            catch
            {
                return null;
            }

        }

分类:

技术点:

相关文章:

  • 2021-12-04
  • 2021-10-25
  • 2022-12-23
  • 2021-12-26
  • 2021-12-23
  • 2021-11-23
  • 2022-01-01
  • 2021-07-19
猜你喜欢
  • 2021-12-23
  • 2022-12-23
  • 2021-04-10
  • 2021-08-10
  • 2022-12-23
  • 2022-12-23
  • 2021-07-26
相关资源
相似解决方案