国产一级a片免费看高清,亚洲熟女中文字幕在线视频,黄三级高清在线播放,免费黄色视频在线看

打開APP
userphoto
未登錄

開通VIP,暢享免費(fèi)電子書等14項(xiàng)超值服

開通VIP
操作圖片類(C#)

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


namespace Baolee.GeneralMethod
{
 /// <summary>
 /// ImageClass 的摘要說(shuō)明。
 /// </summary>
 public class ImageClass
 {

  // Fields
  public string ErrMessage;
  private int ImageHeight;
  private int ImageWidth;
  private Image ResourceImage;

  /// <summary>
  ///
  /// </summary>
  /// <param name="ImageFileName"></param>
  public ImageClass(string ImageFileName)
  {
   this.ResourceImage = Image.FromFile(ImageFileName);
   this.ErrMessage = "";
  }
  /// <summary>
  ///
  /// </summary>
  /// <param name="Percent"></param>
  /// <returns></returns>
  public Image GetReducedImage(double Percent)
  {
   try
   {
    Image.GetThumbnailImageAbort callback = new Image.GetThumbnailImageAbort(this.ThumbnailCallback);
    this.ImageWidth = Convert.ToInt32((double) (this.ResourceImage.Width * Percent));
    this.ImageHeight = Convert.ToInt32((double) (this.ResourceImage.Width * Percent));
    return this.ResourceImage.GetThumbnailImage(this.ImageWidth, this.ImageHeight, callback, IntPtr.Zero);
   }
   catch (Exception exception)
   {
    this.ErrMessage = exception.Message;
    return null;
   }
  }
  /// <summary>
  ///
  /// </summary>
  /// <param name="Percent"></param>
  /// <param name="targetFilePath"></param>
  /// <returns></returns>
  public bool GetReducedImage(double Percent, string targetFilePath)
  {
   try
   {
    Image.GetThumbnailImageAbort callback = new Image.GetThumbnailImageAbort(this.ThumbnailCallback);
    this.ImageWidth = Convert.ToInt32((double) (this.ResourceImage.Width * Percent));
    this.ImageHeight = Convert.ToInt32((double) (this.ResourceImage.Width * Percent));
    Image image = this.ResourceImage.GetThumbnailImage(this.ImageWidth, this.ImageHeight, callback, IntPtr.Zero);
    image.Save(targetFilePath, ImageFormat.Jpeg);
    image.Dispose();
    return true;
   }
   catch (Exception exception)
   {
    this.ErrMessage = exception.Message;
    return false;
   }
  }
  /// <summary>
  ///
  /// </summary>
  /// <param name="Width"></param>
  /// <param name="Height"></param>
  /// <returns></returns>
  public Image GetReducedImage(int Width, int Height)
  {
   try
   {
    Image.GetThumbnailImageAbort callback = new Image.GetThumbnailImageAbort(this.ThumbnailCallback);
    return this.ResourceImage.GetThumbnailImage(Width, Height, callback, IntPtr.Zero);
   }
   catch (Exception exception)
   {
    this.ErrMessage = exception.Message;
    return null;
   }
  }
  /// <summary>
  ///
  /// </summary>
  /// <param name="Width"></param>
  /// <param name="Height"></param>
  /// <param name="targetFilePath"></param>
  /// <returns></returns>
  public bool GetReducedImage(int Width, int Height, string targetFilePath)
  {
   try
   {
    Image.GetThumbnailImageAbort callback = new Image.GetThumbnailImageAbort(this.ThumbnailCallback);
    Image image = this.ResourceImage.GetThumbnailImage(Width, Height, callback, IntPtr.Zero);
    image.Save(targetFilePath);
    image.Dispose();
    return true;
   }
   catch (Exception exception)
   {
    this.ErrMessage = exception.Message;
    return false;
   }
  }
  /// <summary>
  ///
  /// </summary>
  /// <returns></returns>
  public bool ThumbnailCallback()
  {
   return false;
  }
 }
}
 

本站僅提供存儲(chǔ)服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊舉報(bào)。
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
C#放縮、截取、合并圖片并生成高質(zhì)量新圖的類
java實(shí)現(xiàn)上傳圖片后的縮放處理
opencv 畫矩形
jquery在線預(yù)覽PDF文件,打開PDF文件
php 獲取頁(yè)面中指定內(nèi)容的類
一個(gè)好用的PHP圖片壓縮類
更多類似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長(zhǎng)圖 關(guān)注 下載文章
綁定賬號(hào)成功
后續(xù)可登錄賬號(hào)暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服