C# .NET Convert a JPEG Image into a Bitmap structure

回眸只為那壹抹淺笑 提交于 2019-12-22 08:26:09

问题


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.


回答1:


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


来源:https://stackoverflow.com/questions/380604/c-sharp-net-convert-a-jpeg-image-into-a-bitmap-structure

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!