Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to convert System.IO.Stream into an Image?

Tags:

How can I convert a Stream of an image (which I retrieved using the Album.GetArt method from the MediaLibrary) into a usable Image in my application?

like image 219
Newbie Avatar asked Aug 08 '13 19:08

Newbie


People also ask

How to convert Image to stream in C#?

var stream = myImage. ToStream(ImageFormat. Gif); Replace GIF with whatever format is appropriate for your scenario.

What is a System Io stream?

Stream: System. IO. Stream is an abstract class that provides standard methods to transfer bytes (read, write, etc.) to the source. It is like a wrapper class to transfer bytes. Classes that need to read/write bytes from a particular source must implement the Stream class.

How do I convert an image to streaming memory?

MemoryStream memStream = new MemoryStream(); Image. Save(memStream, ImageFormat. Jpeg);

What is output stream in C#?

There are two main streams, the input stream and the output stream. The input stream is used for reading data from a file (read operation) and the output stream is used for writing into the file (write operation). We handle them with types in System.IO. Various Types of C# I/O Classes.


1 Answers

Easy... var img = Bitmap.FromStream(stream);

like image 175
I4V Avatar answered Oct 14 '22 22:10

I4V