我想讀取圖像(TIF圖片)從FTP服務器的圖像(TIF圖片),然後查看它 我使用FTP服務器來讀取這些代碼:讀取FTP服務器
//CREATE AN FTP REQUEST WITH THE DOMAIN AND CREDENTIALS
System.Net.FtpWebRequest tmpReq = (System.Net.FtpWebRequest)System.Net.FtpWebRequest.Create(filePath);
tmpReq.Credentials = new System.Net.NetworkCredential(userName, password);
//GET THE FTP RESPONSE
using (System.Net.WebResponse tmpRes = tmpReq.GetResponse())
{
//GET THE STREAM TO READ THE RESPONSE FROM
using (System.IO.Stream tmpStream = tmpRes.GetResponseStream())
{
//CREATE A TXT READER (COULD BE BINARY OR ANY OTHER TYPE YOU NEED)
using (System.IO.TextReader tmpReader = new System.IO.StreamReader(tmpStream))
{
//read and view image
}
}
}
}
我需要你幫助如何TIF圖像轉換爲JEPG或其他類型,以及如何使用我的代碼
感謝
+1的完美典範 – Shai
IMG讀取。保存(「foo.jpg」,ImageFormat.Jpeg); 這行將保存圖像? – FarOoOosa
你可以在第一個參數中提到你的路徑,比如img.Save(@「d:\ someFolder \ foo.jpg」,ImageFormat.Jpeg); –