zoukankan      html  css  js  c++  java
  • c# 图片等比缩略

    public Bitmap getnew(Image bit, int TargetWidth, int TargetHeight)//beishu参数为放大的倍数。放大缩小都可以,0.8即为缩小至原来的0.8倍
    {
    Bitmap destBitmap = new Bitmap(TargetWidth, TargetHeight);
    Graphics g = Graphics.FromImage(destBitmap);
    g.Clear(Color.Transparent);
    //设置画布的描绘质量
    g.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
    g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
    g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
    g.DrawImage(bit, new Rectangle(0, 0, destBitmap.Width, destBitmap.Height), 0, 0, bit.Width, bit.Height, GraphicsUnit.Pixel);
    g.Dispose();
    return destBitmap;
    }

  • 相关阅读:
    git 文件回退
    git reset
    开源
    android json js 算法 面试
    Android* 2.3.7
    Sqoop HBase Hadoop
    行业案例、技术



  • 原文地址:https://www.cnblogs.com/LTEF/p/9981351.html
Copyright © 2011-2022 走看看