donderdag, april 27, 2006

Messed up bitmap data ? FIXED (SEE ABOVE!)

On is a dat file (from an image field in SQL2000), it is a bitmap file, in an old VB6 programma that image is used and visible. So it is valid data. Problem: no code of vb6 of that prog is available.

My question: What is wrong with the bitmap data? does vb6 add some rubbish to it? I can't load it into image object in C# because a invalid argument exception (because somethings is wrong in the header or ...). I tried every offset (some people say use 78 as offset, because there will be a OLE header), and every offset gives the same error. I get an invalid argument when i do this:
ImageDataStream.Write(ImageData,i,ImageData.Length-i); // ok, tried every value of i
Image img = Image.FromStream(ImageDataStream); // the invalid argument error rises here

I'm trying now to rip the pixeldata and put the pixeldata in a own created bitmapfile with correct header/colormap... But still something is wrong, the pixeldata contains good data and then a piece of FF 00 FF 00 of the same length and that a few times....

Anybody knows what vb6 does to the imagedata when saving it to SQL2000 ? any tips are welcome.......

Geen opmerkingen: