469,327 Members | 1,315 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,327 developers. It's quick & easy.

Raw Image Drawing

Hi All,
currently i am working with raw images using C#.NET .i want to darw in my picture box.i can read that image file as byte array.but i could not display the same .if i try to display (draw) that file like other files(JPEG,GIF etc..).it throws the parameter invalid exception .my file size is 153700 bytes.simply said how to draw a image from array values using C#.NET.
please any one help me,this is the major problem of my project.

thanks and regards
rajesh.
Feb 3 '07 #1
10 9288
kenobewan
4,871 Expert 4TB
This article may help:
Drawing Serpinski's Triangle with ASP.NET
Feb 3 '07 #2
This article may help:
Drawing Serpinski's Triangle with ASP.NET

Hi kenobewan ,
Thanks to consider me. I have tried this link, But i'm in the same problem.I have to explain my situation in detail.Please help me.I'm new to this .NET environment.

I want to draw a medical image .Its a color raw image which is taken from IR camera.The image has 153700 bytes.Byte per pixel is 2.The last 100 bytes are unwanted information.So,the image has 76800 pixels(i want to draw 320*240 image). I can read the image by this code

FileStream fs = new FileStream (@"Image Location", FileMode.Open);

byte[] image = new byte[fs.Length-100];

BinaryReader br= new BinaryReader(fs);

br.Read(image,0,(int)fs.Length-100);

Also i can split these bytes as two by two.To draw these image values,how i can proceed.i drew this image by convert to .bmp format successfully,I need to draw as raw image with out any loss of information.
GDI+ and other methods in .NET only supporting some Standard formats like .jpg,.gif,.tiff etc...So i have to draw byte by byte..please help,How can i do this.

thanks and regards
rajesh,
Feb 4 '07 #3
kenobewan
4,871 Expert 4TB
I hope that this article will be more helpful:
Binary streaming of large images from Database
Feb 6 '07 #4
sorry,
The link you have sent won't help me .because my image is not a standard file ..bitmap class only accepting some standard formats.i could not use bitmap class to assign my image.please gothrough this problem.
Feb 6 '07 #5
Hi,

I've got the same problem:

in a C DLL, I get an array of unsigned char from a camera. I would like to display this image in a picture box. So there's no bitmap header or something like this, the array only consists of the pure pixel values (in this case 1 byte per pixel).

Doesn't anybody know how to accomplish this?
Feb 24 '07 #6
I have been working on images in vb.net for the last 10 months,Can you send the image file, maybe I will be able to help.
Hi,

I've got the same problem:

in a C DLL, I get an array of unsigned char from a camera. I would like to display this image in a picture box. So there's no bitmap header or something like this, the array only consists of the pure pixel values (in this case 1 byte per pixel).

Doesn't anybody know how to accomplish this?
Feb 27 '07 #7
Hi,

this code reproduces my problem... Thanks in advance for your help, I appreciate that!

Dim i As Byte
Dim nums(64 * 48) As Byte

Dim j As Integer
For j = 1 To 64 * 48
nums(j) = j Mod 255
Next

Dim bmp As New Bitmap(64, 48, 1 * 64, Imaging.PixelFormat.Format8bppIndexed, nums(0))

Dim rect As New Rectangle(0, 0, bmp.Width, bmp.Height)
Dim bmpData As System.Drawing.Imaging.BitmapData = bmp.LockBits(rect, Drawing.Imaging.ImageLockMode.ReadWrite, bmp.PixelFormat)

Dim ptr As IntPtr = bmpData.Scan0

System.Runtime.InteropServices.Marshal.Copy(nums, 0, ptr, 64 * 48)

bmp.UnlockBits(bmpData)
PictureBox1.Image = bmp



What I get in the PictureBox display is an awkward coloured image, but I expected a grayscale image.



I have been working on images in vb.net for the last 10 months,Can you send the image file, maybe I will be able to help.
Mar 1 '07 #8
marisk
1
I've got the same problem:

in a C DLL, I get an array of unsigned char from a camera. I would like to display this image in a picture box. So there's no bitmap header or something like this, the array only consists of the pure pixel values (in this case 1 byte per pixel).

I would like to accomplish the same.. please help if you have solved the issue..

Greatly appreciate it..

maris
Mar 9 '07 #9
Hi,

I could solve the problem by reading in a 8bit-BMP file from disk first. Then it is possible to access its pixels by the Scan0-function, and copy the raw image pixels into the BMP. Not nice, but it works. If you need the actual code, post.
Mar 14 '07 #10
Hi,

I could solve the problem by reading in a 8bit-BMP file from disk first. Then it is possible to access its pixels by the Scan0-function, and copy the raw image pixels into the BMP. Not nice, but it works. If you need the actual code, post.
Hi,

Can you please post the code.

Thanks in advance,
Krishna
Feb 14 '08 #11

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by Programmer | last post: by
15 posts views Thread by Anand Ganesh | last post: by
reply views Thread by Duncan Welch | last post: by
7 posts views Thread by Scott Schluer | last post: by
3 posts views Thread by Dave Wurtz | last post: by
4 posts views Thread by tshad | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by listenups61195 | last post: by
reply views Thread by Purva khokhar | last post: by
reply views Thread by haryvincent176 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.