Click here to Skip to main content
15,889,651 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hi guys, I want to ask something. Maybe it is a silly question but I got a lot of trouble from this error.
I want to create a bitmap image from byte array that represent the BGR color of the picture. I use this reference http://social.msdn.microsoft.com/Forums/en-NZ/vblanguage/thread/da967cea-7e57-4065-9ce9-f7810341aeff[^] the original author says that the function is okay. But, when I convert it to C#, I got may project was froze. And I use the breakpoint to see whether the bitmap that I have created was valid or not, but I dont know what should I looked to? is it the rawdata? or what is it?
Posted

1 solution

Two things:

1. Definitely validate your byte array before trying to use it. Make sure it is not null and perhaps check the length to ensure there are enough bytes to complete the image.

2. Did you use the code at the end of the thread(it is in C#)? The original post was edited to recommend that the code at the end of the thread be used, not the one marked answer.
 
Share this answer
 
Comments
Member 7955849 24-Aug-11 14:32pm    
ouch.. my bad. just read the top code of the page. maybe I should try the last code first. But I have some questions first. My project is capture image from webcam and then compress the picture and show it in another computer. for the beginning, I just want to capture 1 frame, and then show it in another picturebox. If I can get the array of byte from 1 frame, and then I use the byte to create an image, it will be definitely work right? Sorry to bothering you by reading this long passage. hehe..
JOAT-MON 24-Aug-11 15:05pm    
I have no idea about that, I have not done any work on webcam streams, but it sounds like it has potential. Do a search on CodeProject, I think this has been addressed before, there may be an article or answer that can help you to accomplish it. Good luck!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900