PC Review


Reply
Thread Tools Rate Thread

C# storing images within an array

 
 
ryan
Guest
Posts: n/a
 
      9th Jul 2011
Hi,
My name is Ryan. I'm learning C# .Net using Visual Studio Express 2010, running on Windows 7. I would like to learn more on how to store an image to byte format within an array.

My question: Looking at the code reference below, how do I change (stream, System.Drawing.Imaging.ImageFormat.Png); to something that would have a direct reference to an image within a file? What are my alternative approaches?

Code sample:

public static byte[] ImageToByte2(Image img)
{
byte[] byteArray = new byte[0];
using (MemoryStream stream = new MemoryStream())
{
img.Save(stream, System.Drawing.Imaging.ImageFormat.Png);
stream.Close();

byteArray = stream.ToArray();
}
return byteArray;
}
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: C# storing images within an array Ryan Microsoft C# .NET 0 18th Jul 2011 05:25 PM
Re: C# storing images within an array Ryan Microsoft C# .NET 1 10th Jul 2011 04:23 PM
Re: C# storing images within an array Ryan Microsoft C# .NET 0 9th Jul 2011 11:14 PM
User Images: Storing in Files VS Storing in Database Jonathan Wood Microsoft ASP .NET 1 2nd Jun 2008 06:56 PM
storing images Chris Microsoft Access Getting Started 1 16th Aug 2004 05:49 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:31 PM.