从程序显示的图片,转换成内存流,创建RasterImage时报文件格式无效,直接给该文件的文件名,报建是成功的。具体代码如下 :
MemoryStream ms = new MemoryStream();
ctrlOcrImageView1.Image.Save(ms, ImageFormat.Jpeg);
//byte[] buffer = ms.ToArray();
RasterCodecs rasterCodecs = new RasterCodecs();
// Load the bitmap page
RasterImage image = null;
string filePath = @"QQ截图20170627170231.jpg";
image = rasterCodecs.Load(ms);
|
|