7
可能重複:
converting a base 64 string to an image and saving it如何到Base64 PNG圖像串爲PNG格式轉換成C#
我有編碼爲Base64編碼字符串PNG圖像。我需要將此字符串轉換爲PNG格式。我怎樣才能在C#中進行轉換?
可能重複:
converting a base 64 string to an image and saving it如何到Base64 PNG圖像串爲PNG格式轉換成C#
我有編碼爲Base64編碼字符串PNG圖像。我需要將此字符串轉換爲PNG格式。我怎樣才能在C#中進行轉換?
byte[] data = Convert.FromBase64String(base64String);
using(var stream = new MemoryStream(data, 0, data.Length))
{
Image image = Image.FromStream(stream);
//TODO: do something with image
}
非常好,謝謝。 – user960567 2012-07-13 04:58:47