不知道什麼原因,存取圖片,跑二次存檔的結果會比較好

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.IO;

public partial class Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Image imgSoruce = Image.FromFile(@"D:\img1.JPG");

//第一次
Image img1 = imgSoruce.GetThumbnailImage(200, 300, null, (IntPtr)0);

//第二次
Image img2 = imgSoruce.GetThumbnailImage(200, 300, null, (IntPtr)0);

img1.Save(Server.MapPath("~\\img.jpg"));
img2.Save(Server.MapPath("~\\img2.jpg")); 
}
}

goodlucky 發表在 痞客邦 PIXNET 留言(0) 人氣()