C#.NET转换为JPEG图像转换为位图结构 [英] C# .NET Convert a JPEG Image into a Bitmap structure

查看:567
本文介绍了C#.NET转换为JPEG图像转换为位图结构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个JPEG图像(实际上是在一个数据库中的BLOB),我想导入/转换成位图结构在内存中。原因是,我使用了第三方库,无法与JPEG图像工作,我需要传递一个uncom pressed位(为指针)。所有我发现迄今办法在磁盘上的不同格式之间进行转换,但保存图像为位图第一和重新导入它需要的时间太长了。

我不知道很多关于.NET,但我认为一个System.Drawing.Bitmap应该能够保持uncom pressed数据。我正与C#和Visual Studio 2008。

解决方案

  //斑点是一个byte []从数据库中检索
BMP位图=新位图(新的MemoryStream(BLOB));
 

I have a JPEG "image" (actually a BLOB in a database) which I want to import/convert into a "Bitmap" structure in memory. The reason is that I use a third party library which is unable to work with JPEG images and I need to pass an uncompressed bitmap (as a pointer). All I found so far are ways to convert between different formats on disk but saving the image as bitmap first and re-import it will take far too long.

I don't know much about .NET but I think a System.Drawing.Bitmap should be able to hold the uncompressed data. I'm working with C# and Visual Studio 2008.

解决方案

// blob is a byte[] retrieved from DB
Bitmap bmp = new Bitmap(new MemoryStream(blob));

这篇关于C#.NET转换为JPEG图像转换为位图结构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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