Re: Get RAW Bitmap Data from a file



"RB0135" <robear@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.


but get the "PARAMETER IS INCORRECT" error message, and I know from
other posts, this is usually because the BYTE data is invalid (or
not raw), 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 pixel data without header
bytes. If you wanted to use Image.FromStream, you would have to use a
BinaryReader and read the whole file because only the pixel data is
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 New Bitmap("test.bmp") ? If you need pixel data,
LockBits is the right way, but what do you do want to do with the byte
array in variable rawImage? The pixel data is in it, but that's not
sufficient to be used with Image.FromStream.


Armin

.



Relevant Pages

  • loading bitmaps from files
    ... I'm writing a programme which needs to load bitmap files from ... disk and then access the raw pixel data. ... that raw data as one plane, ... be 32bpp with only one plane, but I just don't know if that is the case. ...
    (microsoft.public.vc.language)
  • Re: loading bitmaps from files
    ... > I'm writing a programme which needs to load bitmap files from ... > disk and then access the raw pixel data. ... > that raw data as one plane, ... If you want 32bpp format, you have to ask for it. ...
    (microsoft.public.vc.language)
  • Re: Image format question [8 bit raw pixel data]
    ... saying that the application should receive an "8 bit raw ... pixel data without headers" image. ... 16 bit per channel is possible. ...
    (comp.graphics.algorithms)

Loading