473,587 Members | 2,448 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to create Bitmap using pixel data

Is someone can give me example?

I want to create Bitmap with pixel data saved in a binary file, the data
file only have red data block and green data block. I have implemented it
with VC6.0, now I want to rewrote it with C#.

My question is

1. using of Bitmap (Int32, Int32, Int32, PixelFormat, IntPtr)
2. how to implement memory copy efficiently in C#

Thanks
Nov 22 '05 #1
1 6581
Hi!
I want to create Bitmap with pixel data saved in a binary file, the data
file only have red data block and green data block. I have implemented it
with VC6.0, now I want to rewrote it with C#.


I have done something like this with GDI and Managed C++ (I don't using
'real' memory blocks with C#) - I can't post the code, because I don't own
it. I can give few hints:

1. Create and fill BITMAPINFO structure
2. Create HBITMAP with CreateDIBitmap
3. Finally: System::Drawing ::Image::FromHb itmap(m_hBitmap );

You've said you have done such thing with VC6.0, so I suppose you familiar
with DrawingContext and stuff... (look into MSDN and 'Windows GDI'). BTW:
search www.codeproject.com - I think I saw there few examples of GDI/GDI+
bitmap handling with C#.

Best regards,
Piotrek

Nov 22 '05 #2

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

Similar topics

1
575
by: Question with BinaryReader | last post by:
Is someone can give me example? I want to create Bitmap with pixel data saved in a binary file, the data file only have red data block and green data block. I have implemented it with VC6.0, now I want to rewrote it with C#. My question is 1. using of Bitmap (Int32, Int32, Int32, PixelFormat, IntPtr) 2. how to implement memory copy...
8
7167
by: James Dean | last post by:
I have 1 bit per pixel information and i have the width and height of this data.Each bit corresponds to a 24 bit colour value. I want to convert this to 24bit per pixel bitmap. Do i need to multiply the width and the height by 24 or just the width?. I tried to multiply the width by 24 but the value is too large?.....what can i do?. The 1bpp...
0
1276
by: James Dean | last post by:
I have trouble displaying a bitmap. I have 1bpp information. I also have a command telling me what color i need to set the bytes to when the colour is switched on. The trouble is i do all this but it will not display properly. I convert this to 8bpp information. I set the relevant pixel to for example "255,0,0" for Red.....is this right?....i...
1
5183
by: Dennis Myrén | last post by:
Hi. I use System.Drawing.Bitmap to copy bitmap pixel data. I use LockBits to retrieve a BitmapData which in turn provides me with the Scan0 property which i then use to loop the pixel data using a byte *. I am aware of that internally GDI+ stores RGB as BGR, therefore i have to manually swap the R and B components of each pixel. Since...
5
7359
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...
3
3110
by: Iwanow | last post by:
Hello! My goal is to develop a program that opens a bitmap, copies its pixels to an ArrayList in order to perform some complex calculations (edge detection, Hough transform etc.), and save resulting image back in some other bitmap. It works pretty fast, except for stages of coping pixels between bitmap (object of type Bitmap) and the...
2
1730
by: Marco Biagioni | last post by:
After i've tried to update a vb 6.0 project to vb.net, using visual studio utility,i can't read correctly data bytes from a .bmp file to insert them in a matrix to operate on. Using vb 6.0 the code was based on Get function: GET #1, PIXELSTART, PHOTO.MATRIX where PHOTO is a structure data type, with a member MATRIX previously defined...
2
2800
by: Marco Biagioni | last post by:
After i've tried to update a vb 6.0 project to vb.net, using visual studio utility,i can't read correctly data bytes from a .bmp file to insert them in a matrix to operate on. Using vb 6.0 the code was based on Get function: GET #1, PIXELSTART, PHOTO.MATRIX where PHOTO is a structure data type, with a member MATRIX previously defined...
7
8189
by: RB0135 | last post by:
Hi All, I have some Windows BMP, 1BPP, monochrome files that I need to get the raw data from to load a graphics buffer on a Roll Printer (which I know can be done). Lets forget about the Roll Printer in this equation as I am not sure I am getting the correct "raw" image from the file. However, when I print what I think is the raw data, I ...
3
3716
by: radu | last post by:
i need a bit of help with few lines of code. 1. i have integer array a = numbers from 0 to 256 2. i have to create a 256 colours bitmap of 500x500 pixels, asign colours as matrix a. ex. bitmap at pixel at row 3 col 5 = colour number is a and save it to disk as a 256 colour bitmap without any compresion as c:\a.bmp. no interface. i have...
0
7920
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8347
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...
0
8220
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...
1
5718
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5394
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3844
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...
0
3879
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2358
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
1
1454
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.