我有一个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.
![图片转换 jpeg转换png格式](https://p.xsw88.cn/allimgs/daicuo/20230903/5405.png)
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));
相关推荐
最新文章