Is it just me or...

Started by
7 comments, last by Andrea 24 years, 1 month ago
I don''t know why, but whenever I save a bitmap using Paint, or Paint Shop Pro, and I try to load it using my program it comes out distorted. It looks like it shifts to the right several pixels. But, whenver I edit an image from a game, and load it with my program, it loads ok. Has anyone else had this problem? Or, do you know how to deal with it? Ps - My program is a program that I "borrowed" that loads bitmaps. I copied the bitmap loading source.
Advertisement
This only applies if you are using directdraw. I had a similair problem before. The problem may be that if the image dimensions are not multiples of 2 then it will load wrong usually.
*** Triality ***
This only applies if you are using directdraw. I had a similair problem before. The problem may be that if the image dimensions are not multiples of 2 then it will load wrong usually.

*** Triality ***
*** Triality ***
Try loading an image that is a multiple of 4 wide.

Hard to tell if it''s the loader or the render, but one or the other is assuming spans(width) are aligned on mulpiles of 2 or 4 bytes.

If it ends up being the loader there is a ton of info on BMP file formats on the Microsoft MSDN site: http://msdn.microsoft.com/isapi/msdnlib.idc?theURL=/library/psdk/gdi/bitmaps_7zfp.htm

--Rick
I think it''s supposed to be a POWER of 2, not a multiple of two. (Again, this only applies if you''re using Direct3D or DirectDraw in > 8bpp mode.
The bitmap might be loaded incorrectly. I noticed once that the bitmaps from my save function only worked in windows paint and it was because one of the offsets in the header was wrong. Check the bytes of the image buffer to see if they match up. ie. make the left one pixel thick of black and then read that column in your buffer.

http://mazurek.dhs.org/3d/
You''re not loading the file in text mode are you? There was some other guy on this site that was having problems with extraneous pixels showing up in his data file and it was because in text mode there were extra ASCII line feed bytes being added everywhere there was an ASCII carriage return byte.
Mike Weldon, a.k.a. FalloutBoymweldon@san.rr.com
RickO is right, the width of a bmp has to be divisible by 4. (powers of 2 are used for textures)

if it isn''t divisible by 4, the BITMAPINFOHEADER reports the desired width in biWidth, but extra pixels are tacked on to the end of each row in the image buffer to make the width of rows divisible by 4. the size the image can be calculated using (biWidth*biHeight)*biBitCount/8. if biWidth isn''t divisible by 4, biSizeImage will report a different value than the one in the equation above.
Are you using 16/24 bpp bitmap or 8 bpp?
The header size of the bitmap is 54 byte but if you use 8 bpp bitmaps you have 1024 byte of palette after the header...
IpSeDiXiT

This topic is closed to new replies.

Advertisement