byte[] imageData=(byte[])row["Image"];
//↑讀進來的圖片檔案就有一定的尺寸了,不過寬不是200
MemoryStream ms = new MemoryStream(imageData, 0, imageData.Length);
Image graph = Image.FromStream(ms);
這個是寬度P_Width = 200;
P_Height這個高度用等比例 =((P_Width)
/ (graph.Width)) * (graph.Height));
Bitmap imageOut = new Bitmap(graph,P_Width,P_Height);
imageOut.Save(放路徑接.jpg檔名);
graph.Dispose();
imageOut.Dispose();
ms.Close();
全站熱搜