【C#】剪切出图片的一部分


using System.Drawing;
using System.Drawing.Imaging;

class Program
{
   static  void Main( string[] args)
  {
     //  画像を読み込む
     string baseFilePath =  @" C:\bitmapBase.gif ";
    Bitmap bmpBase =  new Bitmap(baseFilePath);

     //  画像を切り抜く
    Rectangle rect =  new Rectangle( 2090450100);
    Bitmap bmpNew = bmpBase.Clone(rect, bmpBase.PixelFormat);

     //  画像をGIF形式で保存
     string newFilePath =  @" C:\ bitmapNew.gif ";
    bmpNew.Save(newFilePath, ImageFormat.Gif);

     //  画像リソースを解放
    bmpBase.Dispose();
    bmpNew.Dispose();
  }


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM