473,804 Members | 2,223 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

create Bitmap from rawbuffer(BYTE* )

How can i create a Bitmap from a rawbuffer-BYTE* (from framegrapper).

I do following:

Bitmap *myBit2 = new
Bitmap(wImage,h Image,wImage*si zeof(BYTE),Pixe lFormat::Format 8bppIndexed
,(IntPtr)pbyteB uffer);

pictureBox->set_Image(myBi t2 );

the Bitmap were not correct displayed

MFC
Soja

Nov 16 '05 #1
2 2134
"Soja" <so*****@web.de > wrote in message
news:e9******** ******@TK2MSFTN GP12.phx.gbl...
How can i create a Bitmap from a rawbuffer-BYTE* (from framegrapper).

I do following:

Bitmap *myBit2 = new
Bitmap(wImage,h Image,wImage*si zeof(BYTE),Pixe lFormat::Format 8bppIndexed
,(IntPtr)pbyteB uffer);

pictureBox->set_Image(myBi t2 );

the Bitmap were not correct displayed


Perhaps if you told us how it was being displayed. Wrong colors? Upside
down? Backwards? Not the image at all (garbage)?

Ken
Nov 16 '05 #2
A read cross were displayed(nothi ng) and exception raise after
pictureBox->set_Image(myBi t2);

System.InvalidO perationExcepti on
"Ken Alverson" <Ke*@Alverson.n et> schrieb im Newsbeitrag
news:ep******** ******@TK2MSFTN GP10.phx.gbl...
"Soja" <so*****@web.de > wrote in message
news:e9******** ******@TK2MSFTN GP12.phx.gbl...
How can i create a Bitmap from a rawbuffer-BYTE* (from framegrapper).

I do following:

Bitmap *myBit2 = new
Bitmap(wImage,h Image,wImage*si zeof(BYTE),Pixe lFormat::Format 8bppIndexed
,(IntPtr)pbyteB uffer);

pictureBox->set_Image(myBi t2 );

the Bitmap were not correct displayed


Perhaps if you told us how it was being displayed. Wrong colors? Upside
down? Backwards? Not the image at all (garbage)?

Ken

Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3708
by: James Dean | last post by:
I create a bitmap like this. The width and height are got from the compressed file i am reading. The width and height are in pixels.....1bpp bitmap = new Bitmap(Width,Height,PixelFormat.Format24bppRgb); i have a bitmapdata class and then lock the bits like this. bitmapData = bitmap.LockBits(bounds, ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);
0
3611
by: CroDude | last post by:
Hi all! I have problems when writting bitmap to a byte array and after reading it back form byte to Bitmap object. What I do is this: First I throw Bitmap to a memory-stream and then I write it into byte from a stream. Exception (System.ArgumentException: Invalid parameter used) occurs when reading from byte over a memory-stream back to the Bitmap object. Please help, I'm really stuck here! Here's the code I use (Sorry for a long...
3
69663
by: biteme | last post by:
I have an array of bytes which i want to write out to a file. What classes do i need that do this?? i know you can do stuff with binary writer and stream writer, but how do i create a file with my data in it? thanks...
1
5800
by: Angel Filev | last post by:
Hi everyone, I am trying to store a file as a binary array in an "image" field in SQL Server 2000 database. It works OK except for the ".PDF" files, which I believe get corrupted in the process of reading a stream to a byte array. Uploading and downloading seems to work fine, but "Acrobat" pop ups "The file is damaged and could not be repaired" error. Is there any way I can make this to work.
5
7380
by: Lance | last post by:
I need to create a Drawing.Bitmap from an array of integer values. My current technique creates a bitmap that eventually becomes corrupt (i.e., the bitmap's pixels change to a different color after a while). Can somebody please tell me what I'm doing wrong? Here is a sample: Public Shared Function CreateBitmapFromArray( _ ByVal width As Integer, _ ByVal height As Integer, _ ByVal pixelFormat As Drawing.Imaging.PixelFormat, _
8
4393
by: gsmith | last post by:
Hello, I am developing a video recording (mjpeg) system which records large binary files. I need to read the JPEG data from the binary file and create a bitmap object to be displayed. Unfortunately I cannot find an efficient way to do this in C#. I need to do this at 10fps+ with 1hour+ data files. My current approach is read a byte from the filestream, then create a MemoryStream to the created byte and then a bitmap from the memory
4
2450
by: =?Utf-8?B?U2hhcm9u?= | last post by:
I have an RGB color held in a Int32 variable. I using an unsafe code to loop through Bitmap data, and by using the BitmapData.Scan0 pointer I need to copy the Int32 color value into the Bitmap data. But using the: ///////////////////////////////////////////////////////////////////////////////////////// Bitmap img = new Bitmap(100, 200, System.Drawing.Imaging.PixelFormat.Format32bppRgb); System.Drawing.Imaging.BitmapData refData =...
5
4177
by: WT | last post by:
I am trying to crete a gif file with transparent backcolor on the fly but it seems that GDI refuses to do this. I am using samples from Bob Powell but it doesn't seem to work. First create a Bitmap public Bitmap MakeImage(string Text, SizeF Sf) { int width = (int)(Sf.Width)+2;
2
2317
by: jenniamia | last post by:
I need to make the string "myFile" into a byte and then put it in the database as a file/image, where later it needs to be pulled out and back into a string from the byte. I'm really having trouble gettting it back into a string afterwards, but I don't even know if the data is being put in the database with correct values. Any suggestions or pointers would be much appreciated. Thanks! (I posted the main section I'm having trouble with, but I...
0
9594
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10595
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10343
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10341
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10089
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9171
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5530
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5673
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4308
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.