Subj : Re: Screen Capture function To : borland.public.cpp.borlandcpp From : Bob Gonder Date : Sat Jul 03 2004 11:07 am Jeff Baker wrote: > I'm not sure >what you mean by "pad" but I'll have to figure it out because with all your >suggestions (other then padding) Padding is adding space to align data structures. You do such in the following statement in the color palet. It is also needed in the bmp data, but in this case the width is 640, and is already aligned, so no padding is needed there. fputc((short)spacer,out); > it performs the same. It performs how? >typedef struct { >char id[2]; >long file_size, reserved, offset, /*everything below this is header*/ header_size, width, height; >short planes, bpp; >long compression, bitmap_size, hres, vres, colors, important; >} bmp_file; Is this structure aligned (packed) correctly? Is file_size at bmp_file+2? You can remove all doubt by removing the 'BM' id and just writing it to the file. >bmp.file_size = 22326; Is that the correct file size? 640*480 alone is bigger than that. >bmp.width = 640; >bmp.height = 480; >bmp.planes = 1; >bmp.bpp = 4; >bmp.compression = 0; >bmp.bitmap_size = 22208; Is that the correct size? You are writting 640*480 bytes! >bmp.hres = 3780; >bmp.vres = 3780; > for (x = 0; x <= (bmp.width-1); x++) > { > pixel = getpixel(x,y); > fwrite(&pixel,sizeof(pixel),1,out); > } I think your pixels need to go into the file as 4bit values. That means you need to pack them 2 pixels per byte/write. .