Snapshot problem with BMP and 12 Bytes Extra Needed
Keywords: Snapshot problem BMP 12 bytes shift 12 bytes
Question:
I use the program below to generate a Snapshot BMP, which will be uploaded to the web, see here:http://www.biewer.com/wetter.pngHowever the bitmap created is not correct, at the right side I miss some pixels which are added at the left. Looks like a memory allocation problem to me. Anyone has any ideas?Snapshot(0) size=BinaryClipGet(0,8) bb=BinaryAlloc(size) BinaryClipGet(bb,8) bb2=BinaryAlloc(size+14) BinaryPokeStr(bb2,0,"BM") BinaryPoke4(bb2,2,size+14) tableloc=BinaryPeek4(bb,0)+14 BinaryPoke4(bb2,10,tableloc) BinaryCopy(bb2,14,bb,0,size) BinaryWrite(bb2,"\\Peacock\Shared\UserProg\weblinks\wetter.bmp") BinaryFree(bb) BinaryFree(bb2)Answer:
Maybe change:BinaryPoke4(bb2,10,tableloc)to:BinaryPoke4(bb2,10,tableloc+12)and let me know if that helps...Question (cont'd):
Yes, this helped!!! Is there some background regarding the little modification I should know?Answer:
Well in the initial script I had tried to read the BMP file documentation and make a bmp file from a SnapShot image.It started working and I stopped.
However it seems there was a small error.
The fix seems to correct the error.
A confusing problem is that there are several different BMP file formats. Not all programs recognise all formats.
When you save a file is MSPAINT, it save it in a different, more compressed format than the sample code saves it in, making debugging more difficult. This also depends on your version of MSPAINT.
Article ID: W15109