使用image.fromstream创建图像数组 [英] creating array of image using image.fromstream

查看:102
本文介绍了使用image.fromstream创建图像数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何用流读取System.Drawing.Image数组

此代码不起作用:

 < span class =code-keyword> int  i =  0 ; 
Image [] image = new 图片[ 100 ];
while (reader.Read())
{
string filePath =( string )reader [ Path];
byte [] transactionContext =( byte [])reader [ TransactionContext];
SqlFileStream sqlFileStream = new SqlFileStream(filePath,transactionContext,FileAccess.Read);
byte [] data = new byte [Convert.ToInt32(sqlFileStream.Length)];
sqlFileStream2.Read(data, 0 ,Convert.ToInt32(sqlFileStream.Length));
image [i] = System.Drawing.Image.FromStream(sqlFileStream, true true );
// sqlFileStream.Close();
i ++;

}

解决方案

查看以下链接



使用流阅读System.Drawing.Image

how can i read an array of System.Drawing.Image with a stream
this code doen't work:

int i=0;
    Image [] image = new Image[100];
        while (reader.Read())
    {
        string filePath = (string)reader["Path"];
        byte[] transactionContext = (byte[])reader["TransactionContext"];
        SqlFileStream sqlFileStream = new SqlFileStream(filePath, transactionContext, FileAccess.Read);
        byte[] data = new byte[Convert.ToInt32(sqlFileStream.Length)];
        sqlFileStream2.Read(data, 0, Convert.ToInt32(sqlFileStream.Length));
        image[i] = System.Drawing.Image.FromStream(sqlFileStream, true, true);
        //sqlFileStream.Close();
        i++;

    }

解决方案

check following link

read System.Drawing.Image with a stream


这篇关于使用image.fromstream创建图像数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆