【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