예제 #1
0
 /// <summary>
 /// 生成图片
 /// </summary>
 public void GenerateImg()
 {
     Thumbnail thumg = new Thumbnail(Url, BrowserWidth);
     _bit = thumg.GenerateImage();
     //根据指定的宽度和高度缩放图片
     if (TargetImg.IsCustomer)
     {
         _bit = ImgHelper.ResizeCut(_bit, TargetImg.TargetWidth, TargetImg.TargetHeight);
     }
     //保存图片
     _bit.Save(TargetImg.FullName, TargetImg.Format);
     _bit.Dispose();
 }
예제 #2
0
 /// <summary>
 /// 获取网页的图片
 /// </summary>
 /// <param name="url">网页地址</param>
 /// <param name="browserWidth">浏览器宽度</param>
 /// <param name="browserHeight">浏览器高度</param>
 /// <param name="tWidth">生成图片宽度</param>
 /// <param name="tHeight">生成图片高度</param>
 public static Bitmap GetThumbnail(string url, int browserWidth, int browserHeight, int tWidth, int tHeight)
 {
     Thumbnail thumb = new Thumbnail(url, browserWidth, browserHeight, tWidth, tHeight);
     return thumb.GenerateImage();
 }