Re: Get RAW Bitmap Data from a file
- From: RB0135 <robear@xxxxxxxxxxxxx>
- Date: Sat, 17 May 2008 20:10:38 -0700 (PDT)
Thanks for your reply..
The code I used and presented in the original post was from the MS
Robotic Lib SDK and does compile OK..
I understand your point about the redim, but mine compiles fine
without it...
The part of code using the MemoryStream and a picture box, was another
Idea I was testing to get the bytes, but it is not relevant to the
overall issue.
The various bits of code are tests I am trying to do to get PIXEL DATA
in the right format and the right data from the BMP file.
The data is transferred to the Roll Printer in Bytes, where it
interperets it. Each bit is on or off.
All this is explained in the original post.
Thats what I need the rawimage data to be.. A bit representation of
the image from the BMP file.. I dont want the header information,
just, I suppose, what the image looks like in Bytes.
Does this make sense?
From your reply, the lockbits is the right way to go, but I am not
getting the representation needed from the file.
I have read that BMP's store the data from bottom to top, left to
right (or similar).. Is this the case?
Do I need more processing of the rawimage data to get the
representation of the image from it?
Thanks again,
Robert
On May 18, 10:28 am, "Armin Zingler" <az.nos...@xxxxxxxxxx> wrote:
"RB0135" <rob...@xxxxxxxxxxxxx> schrieb
Dim rawImage() As Byte = Nothing 'the image as a byte[]
You don't have to set it to Nothing because it is Nothing as you have
not assigned anything yet.
rawImage = New Byte(size - 1)
Can't compile this. The syntax above does not work. ReDim has to be
used.
butgetthe "PARAMETER IS INCORRECT" error message, and I know from
other posts, this is usually because the BYTEdatais invalid (or
notraw), although the byte length returned is 2880 bytes, which
does equate to the width*height*8 of the image.
I'm not sure...:
You try Image.FromStream but you only have the pixeldatawithout header
bytes. If you wanted to use Image.FromStream, you would have to use a
BinaryReader and read the wholefilebecause only the pixeldatais
insufficient. Or you have to open the Filestream and pass it to
Image.Fromstream directly. However, why don't you then use
Image.FromFile or NewBitmap("test.bmp") ? If you need pixeldata,
LockBits is the right way, but what do you do want to do with the byte
array in variable rawImage? The pixeldatais in it, but that's not
sufficient to be used with Image.FromStream.
Armin
.
- Follow-Ups:
- Re: Get RAW Bitmap Data from a file
- From: Armin Zingler
- Re: Get RAW Bitmap Data from a file
- References:
- Get RAW Bitmap Data from a file
- From: RB0135
- Re: Get RAW Bitmap Data from a file
- From: Armin Zingler
- Get RAW Bitmap Data from a file
- Prev by Date: Re: HELP ME
- Next by Date: disappointed
- Previous by thread: Re: Get RAW Bitmap Data from a file
- Next by thread: Re: Get RAW Bitmap Data from a file
- Index(es):
Relevant Pages
|
Loading