Hi I have a problem I want to load an image in a 2D array. I would appreciate it if any one knows how. Sorry I cannot give any help but what I have done so far didn't work.
Thanks in advance.
Thanks in advance.
System.Drawing.Image img = System.Drawing.Image.FromFile("someimagefile");
MemoryStream ms = new MemoryStream();
img.Save(ms, System.Drawing.Imaging.ImageFormat.Gif);
byte[] bytes = ms.ToArray();
System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap(@"pathto.bmp", true);
byte[,] imgary = new byte[bitmap.Width,bitmap.Height];
int x,y;
for (x = 0; x < bitmap.Width; x++)
{
for (y = 0; y < bitmap.Height; y++)
{
imgary[x,y] = bitmap.GetPixel(x,y);
}
}
| Thread starter | Similar threads | Forum | Replies | Date |
|---|---|---|---|---|
| A | How do I solve this problem using Kirchhoff's laws, everyone? | Homework Help | 15 | |
|
|
Bosch oven problem | Technical Repair | 4 | |
|
|
Problem with powering DIY boost converter | Power Electronics | 7 | |
| G | problem in loading the program to pic | Microcontrollers | 2 | |
| W | will there be any loading problem | General Electronics Chat | 1 |