473,551 Members | 2,794 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Raw Image Drawing

4 New Member
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 9847
kenobewan
4,871 Recognized Expert Specialist
This article may help:
Drawing Serpinski's Triangle with ASP.NET
Feb 3 '07 #2
rajeshkannan2006
4 New Member
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 Recognized Expert Specialist
I hope that this article will be more helpful:
Binary streaming of large images from Database
Feb 6 '07 #4
rajeshkannan2006
4 New Member
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
atlastraeger
3 New Member
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
safalmittal
4 New Member
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
atlastraeger
3 New Member
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.PixelFo rmat.Format8bpp Indexed, nums(0))

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

Dim ptr As IntPtr = bmpData.Scan0

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

bmp.UnlockBits( bmpData)
PictureBox1.Ima ge = 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 New Member
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
atlastraeger
3 New Member
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

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

Similar topics

2
3112
by: Programmer | last post by:
Hi all Here is my problem I want to create an image so i can pass it on an object to put it as watermark in my pdf report Here is what i have write so far Dim objBitmap As System.Drawing.Bitmap
15
31778
by: Anand Ganesh | last post by:
HI All, I have an Image. I want to clip a portion of it and copy to another image. How to do this? I know the bounding rectangle to clip. Any suggestions please. Thanks for your time and help. Regards
1
3624
by: Novice | last post by:
I'm afraid I will incur the wraith of Mr. Powell on this one - but I did read his #1 FAQ and some others and I still can't figure this out. I created this little c# app. and I have a PictureBox in my Form. I load this image from the filesystem into the PictureBox and then I draw random little lines on the image. Then when I minimize and...
0
1638
by: Duncan Welch | last post by:
I've got users uploading a file, which I then want resize, make a thumbnail out of, then delete. The image and thumbnail are working fine, but when I try to delete the image, I get an error: "The process cannot access the file "c:\inetpub\wwwroot\pictures\1\21_orig.jpg" because it is being used by another process. " I'm using the...
7
3377
by: Scott Schluer | last post by:
Is there a way to use the Image class to convert a color photo (GIF or JPEG) to a B&W photo? Thanks, Scott
0
1897
by: Deepak C.G via .NET 247 | last post by:
I want to dispose the image object in my child form, unless I won't dispose this object i can't delete the image file in my folder. I get this error in MDIparent form "An unhandled exception of type 'System.ArgumentException' occurred in system.windows.forms.dll" "Additional information: Invalid parameter used." Here is my code:-
3
5136
by: Dave Wurtz | last post by:
All, I have an image (bitmap) that I want to change all of the blue pixels to red, for example. Is this possible to do? Thanks in advance! Dave Wurtz
4
2739
by: tshad | last post by:
I am trying to set up an Image authorization where you type in the value that is in a picture to log on to our site. I found a program that is supposed to do it, but it doesn't seem to work. It should put a blue and yellow box on the page with "This is a test" as part of the picture. But what I get is a broken Gif. The other problem is...
5
3353
by: Jerry J | last post by:
I want to use the System.Drawing.Image class. According to the help file, this is an abstract base class. Because it is supposedly abstract, I created another class that inherits from it. However, when I did this I got the following error: 'System.Drawing.Image.Image()' is inaccessible due to its protection level Looking at other online...
4
3804
by: Greg | last post by:
I've searched everywhere for a solution Microsoft .NET Framework V 2.0.50727 AutoEventWireup="false" image2.aspx resize an image on the fly but Page_Load is triggered twice: Any suggestion? Here is the code behind:
0
7565
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
7492
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...
0
7768
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. ...
0
8002
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
7847
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...
0
3534
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
3520
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1981
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
1097
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.