Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

c#

.net

jpeg

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.

like image 764
asdrubael Avatar asked Dec 19 '08 10:12

asdrubael


People also ask

What C is used for?

C programming language is a machine-independent programming language that is mainly used to create many types of applications and operating systems such as Windows, and other complicated programs such as the Oracle database, Git, Python interpreter, and games and is considered a programming foundation in the process of ...

What is the full name of C?

In the real sense it has no meaning or full form. It was developed by Dennis Ritchie and Ken Thompson at AT&T bell Lab. First, they used to call it as B language then later they made some improvement into it and renamed it as C and its superscript as C++ which was invented by Dr.

Is C language easy?

C is a general-purpose language that most programmers learn before moving on to more complex languages. From Unix and Windows to Tic Tac Toe and Photoshop, several of the most commonly used applications today have been built on C. It is easy to learn because: A simple syntax with only 32 keywords.

What is C language basics?

What is C? C is a general-purpose programming language created by Dennis Ritchie at the Bell Laboratories in 1972. It is a very popular language, despite being old. C is strongly associated with UNIX, as it was developed to write the UNIX operating system.


1 Answers

// blob is a byte[] retrieved from DB
Bitmap bmp = new Bitmap(new MemoryStream(blob)); 
like image 115
mmx Avatar answered Nov 03 '22 19:11

mmx