我想在从 Azure Blob 下载之前调整图片的大小。事实上,我的问题是,我有一个3000到5000张图片的列表,我必须从Azure下载。CloudBlockBlob
通过 DownloadToStream
到 MemoryStream
并使用它们生成一个附有图片的Excel文件。
string ext = System.IO.Path.GetExtension(path).Trim();
if (ext.ToLower() == ".png" || ext.ToLower() == ".gif" || ext.ToLower() == ".jpg"
|| ext.ToLower() =="jpeg" || ext.ToLower() == "bmp")
{
ws.Cell(cell.Address).Value = "";
ws.Row(rowIndex).Height = 100;
CloudBlockBlob cloudBlockBlob = new CloudBlockBlob(new Uri(path.Trim()));
if (cloudBlockBlob.Exists())
{
var memorystream = new MemoryStream();
cloudBlockBlob.DownloadToStream(memorystream);
var image = ws.AddPicture(memorystream).MoveTo(ws.Cell(cell.Address.RowNumber,cell.Address.ColumnNumber)).
WithSize(150, Convert.ToInt32(ws.Row(rowIndex).Height)); }
}
发生性能问题,请帮助。