Re: Get RAW Bitmap Data from a file

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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

.



Relevant Pages

  • Re: Access xp - Why does debugger break in when I have no breakpoi
    ... And thanks for not pointing out my basic math miscalc: the original post was ... today with an Access database somebody else wrote. ... Comment out the line on which the breakpoint occurs. ... can compile without it. ...
    (microsoft.public.access.modulesdaovba)
  • Re: Javadoc fails on a BOM for UTF8
    ... According to the Unicode ... > doc, both in my original post and this previous one, this is the sequence ... can you compile the file, i.e. does javac also choke on the BOM, or does it compile ... Regards, ...
    (comp.lang.java.help)
  • Re: fatal error C1083: Cannot open include file: stdafx.h: No such file or directory
    ... I was just able to get the compile done. ... When using the "Project from existing code" in Visual Studio, what would the "normal" way be for getting/creating an "stdafx.h" file if the "stdafx.h" file itself was not included with the original .CPP file? ... As I said in my original post, I'm fairly unfamiliar with VS2008, so that information would be greatly appreciated. ...
    (microsoft.public.vstudio.general)
  • Re: Arabic characters
    ... I did compile the list myself (read the original post), ... I am learning and wanted to ... thread and plan to learn more, ...
    (sci.lang)
  • Re: Is there something basic that I have missed on the upgrade to VS2005?
    ... Quote from my original post ... ... >If you cut/paste this code into a new project it will compile, ... >> I suspect that I am doing something wrong and I suspect that it is in ... >> fine before the upgrade to VS2005. ...
    (microsoft.public.vc.stl)