Talk:BMP file format

From Wikipedia, the free encyclopedia
Jump to: navigation, search
WikiProject Computing / Software (Rated C-class, High-importance)
WikiProject icon This article is within the scope of WikiProject Computing, a collaborative effort to improve the coverage of computers, computing, and information technology on Wikipedia.
C-Class article C  Quality: C-Class
 High  Importance: High
Taskforce icon
This article is supported by WikiProject Software.


While this is not so relevant, if you apply zlib compression to a bitmap the resulting filesize is about the same as for png. --Marco 17:55, 6 December 2005 (UTC)

No, PNG is usually smaller. It's not the compression algorithm alone that's behind PNG's superior compression, it's also the filters performed on the image before the zlib compression. That's the same reason why a FLAC file will usually be smaller than a zlib'ed WAV file.
It depends, the filters are rarely a benifit with indexed color, for truecolor you may well be correct though. Plugwash 21:58, 8 July 2006 (UTC)

I tried both zipping and 7-zipping the wikipedia logo from the example in the article, after having converted it to BMP using Windows XP's mspaint.exe. Wikipedia-logo.png is indeed ~477KB, but when I convert it to 24-bit BMP it's 4,26MB, not 3.2, like it says in the article. And when I zip the BMP, it gets down to 352KB, which is much better than PNG compression. Normal 7-z takes it down to just 226KB. Is this right? Is the mspaint.exe PNG->BMP conversion lossy? MiF86 17:20, 30 April 2007 (UTC)

I discovered that MsPaint (at least on my computer) saves the file as a 32-bit bitmap file even though the format is chosen to be 24-bit. Right click the file and choose Summary to check. That's why the resulting file size is 4.26MB. If you use Microsoft Photo Editor (or any other professional image editor software) to save it as 24-bit bitmap, the file size will be 3.20MB as described.
The fact that your ZIP file size is only 352KB does not indicate that the conversion is lossy. Both PNG->BMP and BMP->PNG are lossless. The difference is due to the efficiency of a compression algorithm when used with a particular type of data. Try the same thing for a different PNG image, the ZIP file size may no longer be smaller! Mdanh2002 14:02, 2 May 2007 (UTC)
It may well be that mspaint is doing something stupid to the image when loading it (such as trying to apply some kind of color correction) that is losing some information and hence making it more compressable but imo it is more likely the wikipedia logo was either not created using maximum compression settings or created using a tool with a poor png implementation. Plugwash 16:38, 2 May 2007 (UTC)
I agree with Mdanh2002. It is difficult to achieve optimal PNG compression. That's why there are several filter methods. The PNG specification recommends adaptive filtering (choosing different filter for each pixel row, after performing a simple analisys algorithm) as the best variant, but in rare cases using no filters (filter method 0) can give better results. This is true for indexed-color PNGs, but can also apply for truecolor images. The problem for most encoder programs is that there is still no good algorithm for choosing filters unless using slow brute-force trials as OptiPNG does. I processed the image with it and it took the file down to 369KB. It is > 352KB, but I found that the logo is in interlaced format! Images stored this way are much more difficult to compress for most compression algorithms. As noted in the specification, PNG can be better than GIF compression, but if not considering interlaced images. I transformed the logo into non-interlaced and OptiPNG produced a 303KB file (again using filter method 0, I guess this image is a very rare case and zlib compression alone works better for it). Normal Zip compression gets the 32-bit bitmap to down 352KB, and maximum - to 301KB. Considering all this I suppose there is no problem with MS Paint. It produces a 32-bit instead of 24-bit bitmap, because the logo has an alpha channel (8-bit) and the Windows XP Paint is trying to preserve it. I tried compressing a 24-bit bitmap with the logo and I got 286KB with Zip and 279KB with OptiPNG...

BPP is used in the formula later, but was not defined undert the title 'Pixel storage', so I have added it to the end of first sentence, where it belongs.-- Varga (talk) 08:55, 11 April 2010 (UTC)

I don't want to be that fly on the wall as miley cirrus would say, but BMP-files have a dual method of zipping. Please read documentation on Adobe Photoshop, and find out that photoshop includes also a MACINTOSH compression algorithm, besides the WINDOWS', and only one to use compression algorithms.

By the way, should this discussion be moved to the PNG article ? Paul188.25.52.8 (talk) 12:42, 6 January 2011 (UTC)

header vs signature[edit]

the header of a file should be callled a signature. If you look up closely you may find a name when reading a signature. In the case of BMP files if you don't have the two starting bits to tell you how to interpret the next bytes, including size, it won't tell you it's a BMP. So I propose to use the HEADER term to acces the next structure, where is the information on the 'details' of the image. ANy program acceses the BMP file and first search it to find out it's BMP it's looking at. Then looks up at the 4-17 bytes to read the information on the image properties. Would anyone agree Header refferes to the first two bytes, and the rest of the bytes up to the 17 are coding the BMP's <private> signature ? "Private" because there may be two signatures for BMPs, but can be only one header. Paul188.25.52.8 (talk) 12:42, 6 January 2011 (UTC)

Please don't mess with the commonly accepted terminology. —Ippopotamus (talk) 23:09, 6 January 2011 (UTC)


I think it would improve readability to not start counting from one again after the header. Saying "It starts at byte #15 of the file" and then saying "Bytes #1-4 specify the header size." doesn't really make sense. --Trent Arms 13:53, 2 June 2006 (UTC)

Hi. I agree with your suggestion. I think it makes more sense to count continuously from 1 to 54. Thanks for taking the efforts to make the necessary changes! --Mdanh2002 14:01, 6 June 2006 (UTC)

Going this way, I suggest the offsets start from #0 instead of #1: most user of a file format information will be coders, and in a vast majority of programming languages the first position is #0, not #1. -- Mike 29 June 2006

I think the whole section needs to be rewritten. May be using tables to describe the headers... and some more information for coders, for example when bytes #50-53 are 0.
Something like that? If no one disagrees, I'll start editing.

Offset # Size ( byte ) Value ( hex ) Meaning
0 2 42 4D [1] Store the data that will be used to identify the bitmap file. Typical values for these 2 bytes are BM.
2 4 00 00 - FF FF Store the size of the bitmap file using a dword.
6 2 Reserved Reserved. Actual value depends on the application that creates the image.
8 2 Reserved Second structure to identify owner of the copyright
10 4 00 00 00 0A - FF FF FF FF Store the offset, i.e. starting position, of the byte where the bitmap data can be found.
0Ax 1 00x - FFx First byte of the raw data in the BMP image.
0Ax + 1 1 00x - FFx Second byte of the raw data in the BMP image.
EOF -2 2 00x 00x - FFx FFx End of the file.

--Lefter 12:08, 26 February 2007 (UTC) Thanks for the suggestions. Go ahead with your editing and do add further elaboration on the file format. Currently a lot of things are not discussed - the article just covers the basics. :) Mdanh2002 15:10, 5 March 2007 (UTC)

Well, I started with my editing. I am new at wikipedia, so please excuse me for the mess in the history page. I am planning more edits, but I'll postpone them until I make a nice version of the page offline.--Lefter 10:02, 6 April 2007 (UTC)

Happy new year 2011 ! Paul188.25.52.8 (talk) 12:52, 6 January 2011 (UTC)

MIME Type?[edit]

Is there a preferred MIME Type for Windows bitmaps? Out of all that I've seen, "image/x-windows-bmp" is the least ambiguous, but it doesn't follow the same pattern as ICO's "image/". —TheMuuj Talk 23:02, 9 July 2006 (UTC)

Preferred by who? Microsoft prefers image/bmp, although this lacks the x- prefix that is (if I remember rightly) required for unofficial MIME media types. --Zundark 12:32, 10 July 2006 (UTC)
For one, what do most browsers expect? I know IE doesn't really care about MIME types anyway, so that's not important. I was trying to configure a web application to properly serve Windows bitmaps and I checked Wikipedia (since pages for other formats have mime-types), but this article does not list a mime-type. I'm not very fond of image/bmp as it's unofficial, although I guess the format is used enough for that to be acceptable. But to be fair, this is not the only format to have ever used the ".bmp" extension. Anyway, if there is a overall consensus on the mime-type it should be in the article, even if it is qualified with "(unofficial)" I suppose. —TheMuuj Talk 20:49, 10 July 2006 (UTC)

Developed by ?[edit]

It seems that IBM also worked on this file format, but it's not reported here. It is only said that BMP was developed by Microsoft. Does anybody know more about this? 16@r 13:52, 10 July 2006 (UTC)

It's possible, as IBM and Microsoft used to work together quite a bit. I do remember that IBM had their own "bmp" format for OS/2. I don't know if they share the same origin, though, or even what the differences are. Plus, I haven't seen an OS/2 bitmap in years. —TheMuuj Talk 20:51, 10 July 2006 (UTC)
See for OS/2 bitmap info. Note that OS/2 V1 and Windows V2 bitmaps are identical.VMS Mosaic 00:32, 11 July 2006 (UTC)

n in the equation[edit]

It's very ambiguous that you must use n=3 in the first place (2^n) and n=24 in the second place (800*600*n)/8 when using the equation.

Sample values used in the equation: 54+4*2^3+(600*800*24)/8 = 1 440 086 / 1024^2 ~= 1.37 ("almost 1.4 megabytes")

I propose the equation to be edited to: 54+4*2^(n/8)+(600*800*n)/8 --Lassi Heikkinen 14:44, 24 July 2006 (UTC)

Hi, the term is the size of the color palette (it takes 4 bytes to describe each color, and there are totally colors). n here is the number of bits per pixel, and there is no need to divide n by 8 to get the number of bytes. In the 2nd term, is the size of the bitmap raw data. As 8 bits form a byte and we are calculating in bytes, we must divide by 8.
Regarding your explanation, I guess the reason why you think the formula is wrong is because the size will get extremely large if where n=24 is added into the formula. I am not too sure about this, but the Italian version of this page suggests that we use (where u(x) is the unit step function) to describe the size of the color palette. That is, the color palette does not exist when the bitmap is 16-bit or higher! Mdanh2002 04:29, 25 July 2006 (UTC)


Usually bitmap files are in Blue-Green-Red format, as described in the page. However, I've noticed that the screenshots that Guild Wars outputs are actually... Green-Red-Blue. The Windows viewer shows them correctly, so I guess there is something in the header that defines this. Which bytes are responsible for the RGB order? If it is already mentioned in the page, I'm sorry for asking such a dumb question. ;)

I would guess they are bitfield bitmaps which are not mentioned in the article (actually there is a lot not discussed in the article; it only covers the basics). Can you make one of the screenshots available on the web so that I can tell you for sure what the format is? VMS Mosaic 00:03, 9 September 2006 (UTC)
Here is the file with the header info: [1]. The file doesn't seem to be compressed, as you can see. About the picture now, notice that the status bars are (starting from top): Green, Red, Blue. But, if you load the file with the usual BGR order, you'll see that the bars are Blue, Green, Red respectively (so, in some way, you can determine the order of the colors in the file with these bars, heheh). --TEO 12:28, 9 September 2006 (UTC)
I don't have a Windows system and the file appears to be in some Windows' archive format. I might be able to local a Windows system somewhere, but a raw BMP file or a more common archive format (e.g., zip, tar, gzip) would be okay.VMS Mosaic 21:59, 9 September 2006 (UTC)
Sorry about that... I uploaded it as an achive to include the header in TXT. I thought of using imageshack for the image file, but I wasn't sure whether sites like that keep the original format or perform any kind of compression. So, here's the new link, ZIP this time: [2] --TEO 17:55, 10 September 2006 (UTC)
It appears to be a normal non-bitfield image. The problem is that there is a two byte gap after the header which causes the image data to be shifted two bytes. Most viewers can deal with "non_standard" headers, but a few cannot. The start of the image data is specified in bytes 10-13. VMS Mosaic 22:34, 10 September 2006 (UTC)


I think it would be really useful to have the hexadecimal position of different parts of the header in addition to the decimal one. If no one disagrees, I'll go ahead and add it. 10:15, 26 September 2006 (UTC)

Why not... Go on ;) --TEO 19:45, 10 November 2006 (UTC)
Well, I don't think it would be useful, and it would lower the signal to noise ratio of the article. Shinobu (talk) 16:10, 19 December 2008 (UTC)
the rank assumed when this details gets confusing for some readers, but you are welcome to cross link to the mp3-article secondary articles.Paul188.25.52.8 (talk) 16:12, 6 January 2011 (UTC)


As I was writing a program to output bitmaps I noticed that MS Paint saves them using big endian. My program uses little endian, so the bitmaps my program produced could not be viewed by Win XP preview or MS Paint. The successfully identified dimensions and header data, they just didn't display them. -- 01:18, 15 May 2007 (UTC)
Nevermind, I was very tired when I wrote this. They are entirely little-endian. -- 17:08, 19 May 2007 (UTC)

Yes, looks like the format uses little-endian encoding. Shouldn't it be said in the article? I think so. Right now I'm programming a BMP r/w library and this article has everything I need BUT this. Also, on section BMP File Header says that "BMP magic number" is 0x424D. Well, it depends. Actually it is 0x4D42, being BMP little-endian. Either we change it to 0x4D42 and add a reference to its endianness, or say 0x42,0x4D. But 0x424D is wrong. 16:43, 24 October 2007 (UTC)

Yes, could you do it? See WP:SOFIXIT. --Kubanczyk 20:12, 24 October 2007 (UTC)


Windows and/or OS/2 bitmap as graphical file format may be just "bitmap", but "bitmap" is not only way to represent graphical files. --Yonkie 06:07, 27 May 2007 (UTC)

What's Different?[edit]

What is the difference between .PNG and .BMP? They look the same according the images! --  PNiddy  Go!  0 18:57, 5 August 2007 (UTC)

PNG are compressed. BMPs have ridiculously large file sizes. 01:51, 23 August 2007 (UTC)

Development history would be good to know[edit]

I read the article and noticed that it mentions Windows and OS2.

How long ago was it developed? Who developed the format? Was it Microsoft or someone else? Was it used for Windows 3.1? ( I assume so, am I correct?)

Perhaps a "History" section be added to the article to answer those and other questions.


JohnI 22:45, 29 August 2007 (UTC)

I came here looking for the same thing, a history is much needed in the article, all the other formats have one. Spladam (talk) 07:14, 15 August 2015 (UTC)

Move, merge, generalize, or something[edit]

We have two articles on file formats: bitmap and bitmap image format. But no article on the generic concept of a bitmap, which way predates these file formats. Why not merge bitmap into bitmap image format, and write an article here on generic bitmaps. If you look at what links here, that would make a lot more sense for most of them. Opinions? Dicklyon 22:50, 13 September 2007 (UTC)

Agreed. This article should be about the bitmap concept. VMS Mosaic 23:23, 13 September 2007 (UTC)

Move Bitmap to Bitmap file format[edit]

I see a bad, unencyclopedic definition here. The fact that Microsoft or IBM calls a file a bitmap does not mean it is appropriate definition for encyclopedic article. A bitmap is quite simply a map of bits, not a map of bits stored in a file, with file having such-and-such blessed format. This article implies for example that a bitmap cannot be read to RAM, because it then ceases to be a bitmap. It becomes just... bitmap data (?!?). And what are other bitmap file formats, listed in bitmap image format storing then? --Kubanczyk 23:01, 13 September 2007 (UTC)

So I take it you're supporting what I suggested above. But do you really want a new article, or just merge it into bitmap image format? I suppose a move would be the easy way to start. Dicklyon 23:04, 13 September 2007 (UTC)
No, I oppose merging anything to "Bitmap image format". Why? Because it has a bad name, too. It should be "Bitmap image file format". I'm still supporting a move proposition. In case a move will be decided, I think the proper "bitmap" article should be written from scratch. --Kubanczyk 07:43, 14 September 2007 (UTC)
I am not strongly attached to the title of "Bitmap image format" or even to the article itself. The easiest solution might be to revert the move of Bitmap from Windows and OS/2 bitmap (the move took place in July), then create a proper Bitmap article. The "Bitmap image format" article can be renamed or even deleted. VMS Mosaic 17:34, 14 September 2007 (UTC)

Bad news after investigation of article's history. Wild renaming and re-defining:

 start as BMP page:
 07:01, 15 April 2003 Zoe (Talk | contribs) (#REDIRECT Raster graphics) (undo)
 07:03, 15 April 2003 Brion VIBBER (Talk | contribs) (Replacing misdirected redirect with stublet) (undo) 
   .BMP or .DIB (device-independent bitmap) is a bitmapped graphics format ... and a simple graphics file format ...
 14:09, 25 August 2003 ( (Talk | contribs) (text moved from BMP) (undo)       # to Windows bitmap
 07:27, 19 December 2006 Yuhong (Talk | contribs) m (moved Windows bitmap to Windows and OS/2 bitmap... 
 01:15, 20 July 2007 Pkkao (Talk | contribs) m (moved Windows and OS/2 bitmap to Bitmap Image) (undo) 
 18:48, 18 August 2007 Thumperward (Talk | contribs) m (moved Bitmap Image to Bitmap image: decap) (undo) 
 18:51, 18 August 2007 Thumperward (Talk | contribs) (13,818 bytes) (reorg intro) (undo) 
   the bitmap image format is a raster graphics format used commonly as a simple graphics file format
 19:00, 18 August 2007 Thumperward (Talk | contribs) (13,625 bytes) (bit more work) (undo)
   the bitmap image format is an image file format used for representing raster graphics
 09:45, 11 September 2007 Thumperward (Talk | contribs) m (moved Bitmap image to Bitmap over redirect: common name) (undo) 

Cause of this is simple: there is no consensus what is this article about:

  • About "file format, a structure of data stored inside a BMP/DIB file"?
  • About "data structure header + info + palette + pixel_data, whether stored inside a BMP/DIB file or in memory"?
  • About "bits, representing pixels of an graphic image"?
  • About "map of bits", not neccessarily representing any pixels?
    • No need, there is already a Bit array article.

Either way, after consensus is reached we have to point out the issues for future users. Otherwise renaming frenzy will continue.

After that, we can work on redirects and sort them out. I would support a bitmap being a redirect here, because it is a common use.

--Kubanczyk 11:16, 15 September 2007 (UTC)

Please read Wikipedia's naming conventions for articles. Please also examine the dates and actions taken regarding page moves; three moves in four-and-a-half years (one of which was a copy-edit) is not "wild renaming".
I suppose I'll go and merge in Bitmap image format, an entirely unnecessary disambig for four concepts with about 90% overlap, when I've got time. Bah. Chris Cunningham 11:32, 18 September 2007 (UTC)
To clarify, it was wild. Not because of insane frequency, but because of a great semantic difference. Same article, same content, many titles implying four wildly different subjects (I listed them above). Maybe you are right that nowadays a bitmap means commonly .bmp file. Hmmm, then I would like to boldly inform readers about a proper word definition (number 3 or 4). And point out similar file formats. I leave for a future WinAPI expert the issue of "1st vs 2nd meaning". --Kubanczyk 13:57, 18 September 2007 (UTC)
Again, please read Wikipedia's common naming guidelines. "Bitmap" is predominantly used outside of specific compsci purposes to mean a simple file format of only rudimentary compression. While there are various different formats which do this, they have a lot in common, and they've got just as valid a claim to the term "bitmap" as any other usage. We've already got bit array and raster graphics to cover specific other uses. So the only call is to whether to bother with a disambiguation page at bitmap and hoist the file formats off to bitmap image (and then later, if and only if that article gets too long, further down to Windows bitmap and other permutations), or whather to just have an otheruses tag at the top of bitmap. For now I think the latter option is the most sensible. But this is a storm in a teacup from where I'm sitting. Chris Cunningham 14:16, 18 September 2007 (UTC)
I see your point. Let's keep the name. Anyway I will add explanation of the term "bitmap" - it's not about "claiming the right", it's about what word bitmap originally meant (before bmp file was introduced). --Kubanczyk 14:33, 18 September 2007 (UTC)
I disagree. Is there any evidence that "Bitmap is predominantly used outside of specific compsci purposes to mean a simple file format of only rudimentary compression." I bet lots of people know "BMP" and only the nerds among them have any idea that it is derived from "bitmap", which is widely known among people educated in EE in the last three decades to mean an array-of-bit organization of an image, whether is a bitmap display, file format, or whatever. The file format is a much narrower topic. Dicklyon 15:26, 18 September 2007 (UTC)
As evidence of what I'm saying take a look at uses of "bitmap" in books. Very few of those are about the file format. Dicklyon 15:28, 18 September 2007 (UTC)
I already edited the article to provide meaning 3 and 4, please correct as needed. I will not debate over renaming it, it seems good enough to me now. --Kubanczyk 15:34, 18 September 2007 (UTC)
Wikipedia isn't a dictionary. If there's no particular subject which the term "bitmap" addresses, we needn't resign ourselves to leaving it for disambiguation if there are still more appropriate titles for related articles. And for four years there's been no particular noise from the EE camp about the bitmap page discussing an image format, so right now I'd take that bet.
Regarding "BMP" being the correct name for the format, BMP is an abbreviation. It's not a formal name, and unless there was reason to believe that there truly is a disconnect between people who would recognise "BMP" and those who would recognise "bitmap", I don't buy that "only the nerds" use "bitmap". Chris Cunningham 16:45, 18 September 2007 (UTC)
Further, Dicklyon's Google Books link appears to have a three-way equal split in definition on the first page. Having already established that "bitmap" to refer to a raster image in general is really just a specialist use of the same thing, that gives a 2:1 split in favour of graphics. Chris Cunningham 16:48, 18 September 2007 (UTC)
I'm not sure what point you're making by "in favour of graphics"; you mean as opposed to photographic images, or what? As to BMP being an abbreviation, I don't think so; if you google for bmp, you get 6X more hits than bmp bitmap, meaning that Microsoft seldom calls a BMP file a bitmap (though it does store a bitmap and is named for that). Dicklyon 17:17, 18 September 2007 (UTC)

I made some edits in which the generality of the term bitmap and specificity of the BMP format are both respected and better integrated. I think it works well to focus on BMP as an example bitmap file format. We should also add a section on other, including compressed, bitmap formats. Dicklyon 19:18, 18 September 2007 (UTC)

Compressed bitmaps[edit]

The article has begun to discuss compressed bitmap file formats, but Kubanczyk has objected, removing JPEG, PNG, GIF, and TIFF, which are among the most commonly used file formats for storing and transferring bitmaps. Maybe we need a clearer distinction between file format for bitmaps and file formats that are literally bitmaps? Dicklyon 21:37, 18 September 2007 (UTC)

Glad that you have noticed that. I try really hard to keep WP:COMMONNAME in mind. Happy editing. --Kubanczyk 21:51, 18 September 2007 (UTC)
I have a bit of a problem with JPEG as a bitmap. It is a lossy format. It does not contain a map of bits (compressed or uncompressed) which have a one-to-one (or several to one in the case of pixmaps) relationship with the image pixels. If you use JPEG to store a bitmap, you cannot get that bitmap back (you can only get an approximation of it back). VMS Mosaic 23:20, 18 September 2007 (UTC)
JPEG contains a bitmap (in the sense of a raster), it's just a slightly different bitmap than before compression :)) Still I don't see a reason to mention JPEG/GIF/... at all. This is covered in Raster graphics. --Kubanczyk 07:21, 19 September 2007 (UTC)
No, it's not covered there. And the JPEG specification does allow for a lossless form, if that's what you need (as do all the others mentioned). Dicklyon 15:50, 19 September 2007 (UTC)
Is this article about image file formats which store images internally using a bitmap or is it about formats which store raster graphics? If the former, then JPEG does not belong because a "standard baseline" (i.e., lossy) JPEG does not in any real sense contain a bitmap (or even, in a strict sense, a raster). A JPEG instead contains a set of mathematical relationships generated from a bitmap. I believe this article should be limited to image file formats which store images internally using a bitmap. VMS Mosaic 17:18, 19 September 2007 (UTC)
And I believe the article should be about bitmaps, including ways of storing them. It is certainly not uncommon to speak of JPEG files as containers for bitmaps (see for example this page or this book or this other book). We shouldn't support the restriction of the generic term bitmap that Microsoft has promulgated. Dicklyon 17:50, 19 September 2007 (UTC)
In that case this article needs completely redone into a much more general discussion of the 'bitmap' concept. Having a specific method of storing a 'bitmap' using a 'bitmap' intermixed with a generic discussion of the term 'bitmap' in relation to raster graphics will be nothing but a confused misleading mess. The current article leads the reader to believe that "standard baseline" JPEGs store images as bitmaps using bitmaps, which is wrong. Note that the JPEG article uses the term 'bitmap image' in comparison to 'JPEG image'. VMS Mosaic 18:19, 19 September 2007 (UTC)
How does "Most other image file formats, such as JPEG, TIFF, PNG, and GIF, to name just a few, also do ultimately store bitmap images (as opposed to vector images), but they are not as often called bitmaps, since they use compressed formats internally" mislead anyone? I agree the article needs more work, to finish the generalization from one format to the more general concept, unless we decide to go the other way, as mentioned in the section below. Dicklyon 18:23, 19 September 2007 (UTC)
Would "Many other image file formats, such as JPEG, TIFF, PNG, and GIF, to name just a few, are used to store bitmap images (as opposed to vector images), but they are not usually referred to as bitmaps, since they use compressed formats internally." be acceptable? Actually, it is still inaccurate given that GIF does use an actual bitmap that is data compressed, just as the bitmap in a BMP can be data compressed using RLE (GIF simply uses a better type of data compression). VMS Mosaic 20:02, 19 September 2007 (UTC)

Serious style issues with new intro[edit]

Look guys, I understand that it's important to be thorough, but we need to define what this article is about, not simply use it as a dumping ground for anything that was ever called a bitmap. So let's see what the lead now discusses:

  1. Eight (!) different file formats.
  2. A dictionary etymology of the word "bitmap".
  3. A related term "pixmap", which can be assumed from the lead to be synonymous (this is true for only some meanings).
  4. Raster graphics in general.

This is unacceptable. Article leads are not there to provide disambiguation. That means one of two things:

  1. This becomes a disambiguation page.
  2. This concentrates on one meaning and punts everything else off to other articles, in a single otheruses tag, at the very top.

As of yesterday, we had a mostly-readable article on Windows bitmaps. Now we have a schizophrenic mess. Until the talk discussion dies down (the three of you still appear to have no consensus on what this article should be defining) editing the article to reflect a broader meaning simply makes it less readable. If there's no consensus on how to move forward soon I'm reverting this to discuss Windows bitmaps pending a convincing rewrite. Chris Cunningham 08:51, 19 September 2007 (UTC)

Now, surely by some mistake (!), I understand that you intend to revert good faith edits. Excuse me, could you write something that will lead to consensus instead? WP:MOS states what article leads should contain, let's use it. I see some of your points, already written about it. --Kubanczyk 12:24, 19 September 2007 (UTC)
There's nothing wrong with reverting good faith edits so long as dialogue with the involved parties has been initiated. I've already written what I think:
  1. This article should be about bitmap image file formats
  2. There's no need to use a less direct title because this is a common usage of the word "bitmap"
  3. Every single word on things which are not bitmap image file formats should either be contained in a disambiguation template at the top, or on a single line explaining the etymology of the word
If there's another line of thought, I'd like to discuss it on here. If there isn't a clear line of thought to argue with, I'd rather the article be reverted to a state where the lead has some sense of direction until there is a clear line of thought. Chris Cunningham 13:20, 19 September 2007 (UTC)
I thought it was a big improvement, myself. I would, since it was my doing, largely. But based on the discussion above, it was clear that the broader concept of a bitmap needed an article, and that moving the article on the specific BMP format to bitmap was a bad idea with little support. I proposed moving that elsewhere and making the broader article here. But, after Kubanczyk did his "change to meaning 1" edit, I saw that it was really not far from the general topic that seemed needed here. His meaning 1 was still a bit narrow, so I broadened it to bitmap images whether in a file or in memory, which is certainly not a stretch. If you object to this broader interpretation of the topic, I suggest we revert all that, move the article to a more sensible title, and then start fresh on a bitmap article. Other ideas? Dicklyon 15:42, 19 September 2007 (UTC)
By the way, I don't really agree that there are multiple meanings in play here. There's one meaning, with multiple narrower applications. Even raster graphics is way too narrow and specific, and the field of computer graphics does not traditionally apply to photographic images. Dicklyon 15:49, 19 September 2007 (UTC)
Then I you've changed from meaning 1 to 3. "Not too far"? Well, but we are suddenly out of WP:COMMONNAME. Face it, today lusers say bitmap=BMP. --Kubanczyk 20:35, 19 September 2007 (UTC)
Lusers. Wow. We are adults today. Chris Cunningham 21:43, 19 September 2007 (UTC)
Well, no hard feelings. How would you call somebody who claims bitmap=BMP (operator = means "is equal to")? --Kubanczyk 09:51, 20 September 2007 (UTC)
I'm not in the habit of calling people names. I rather think I grew out of the fifteen or twenty years ago. Chris Cunningham 11:40, 20 September 2007 (UTC)

The specific file format should not be the main point of discussion at “bitmap”. It should be moved back to a title like Windows and OS/2 bitmap, and what's left here at bitmap should either be a general discussion, or bitmap should be redirected to raster graphics. Someone typing "bitmap" into wikipedia is not going to be looking for the file format. --jacobolus (t) 18:57, 19 September 2007 (UTC)

To respond to both of you at once: at the moment we have a reasonable article on the file format and about three sentences on the other meanings (which, as are clear from the disambiguation template, are mostly covered by other articles already). The idea that the image format must be moved aside because it isn't the One True Meaning of "Bitmap" doesn't hold any water; Wikipedia isn't beholden to have an article at Phish which carefully explains that there are two valid meanings for the word: it just picks the most common usage and disambiguates the other to an equally well-named article.
As for the repeated anecdotal claim that Someone typing "bitmap" into wikipedia is not going to be looking for the file format, I have to once again point out that the article sat with this definition for four years without any apparent kick-up, so I'd assert that this is wrong. Chris Cunningham 19:31, 19 September 2007 (UTC)
Chris, my view is not far from yours: keep the name bitmap, otheruses on top, lead contains 2-3 lines about meanings 3&4, lead mentions non-Microsoft literal-bitmap-files do exist (only acronyms/links), mention "pixmap" only once, drop JPG/GIF, drop "photography issue", main part of article covers exclusively BMP, at the end various remarks about XBM&Co. Other gentlemen, what do you think? Isn't it a good consensus between "the truth" and "too confusing to the public"?
Ah, as a matter of principle, if you'll revert my good faith edit I'll get mad. Seriously. Explanation is here. --Kubanczyk 20:35, 19 September 2007 (UTC)
Article leads are not for disambiguation. End of story. This is not a combined encyclopedia and distionary. The reader is assumed to be on the right article as soon as they fail to click away during the disambig. Zero irrelevant content after that. Zero.
You can get mad if you want, but I'm not editing to hurt people's feelings. I'm editing to create a great encyclopedia. We have style guidelines for a good reason, and I'm going to stick to them. Chris Cunningham 21:42, 19 September 2007 (UTC)
A problem with the current title is that 200 or so pages link to 'bitmap' and in the great majority of cases, the links are not intended to reach a page that discusses only the Windows and OS/2 bitmap file format. My starting to redirect all those links to 'Raster graphics' or the disambiguation page I created for the various bitmap file formats is what got this discussion started. VMS Mosaic 20:13, 19 September 2007 (UTC)
Hey, don't worry, people interested in historical/scientific/programming topics e.g. Commodore PET can actually read. They will notice a proper disambig link, and will understand. On the other hand a huge mass of Windows users will quickly "correct" any "non-MS-compliant" article. --Kubanczyk 20:42, 19 September 2007 (UTC)
If this was an attempted jab at me, check my user page, and hence my employer (or, hell, check my extedned post history), to see how devoted I am to Microsoft and IBM, thanks. Chris Cunningham 21:42, 19 September 2007 (UTC)
I wouldn't worry as much if there was a "proper disambig link", but the current one is not acceptable. I think it should read "This article is about the Windows and OS/2 bitmap file format. For bitmapped graphics in general, see raster graphics. For the bit-addressed data structure, see bit array." I won't complain much if my earlier addition of "For other bitmap formats, see Bitmap image format." is left out. I seriously doubt many windows users (other than experts) have ever heard the term bitmap or have a clue what it means, so I am not at all worried in that regard. VMS Mosaic 21:31, 19 September 2007 (UTC)
So edit the dambig; an obvious style edit like that clearly isn't contentious right now. Chris Cunningham 21:42, 19 September 2007 (UTC)
I think that if we said "This article is about the Windows and OS/2 bitmap file format" we'd be ignoring what we've been doing here. I'll change it in a more accurate direction. Tell me what you think. Dicklyon 21:37, 19 September 2007 (UTC)
Much worse now. "This article is about the storage organization of raster images. For bitmapped graphics in general, see raster graphics." - perfect text for a compiler, completely unreadable for a human. It assumes a newcomer already understands "storage organization", "raster image", "raster graphics", "bitmapped graphics"... Ah, and moreover it doesn't make sense either. I like VMS Mosaic's proposition. --Kubanczyk 21:50, 19 September 2007 (UTC)
My proposition was meant for the case where this article is reverted back to be exclusively about Windows bitmaps (which I do not think should happen). VMS Mosaic 22:06, 19 September 2007 (UTC)
Why can't a comparison of the organization of bitmap file formats be located at raster graphics? I think VMS Mosaic is right that links to bitmap are not intending to hit the current definition. Those would point at BMP or similar. Again, I don't see why general information can't go at raster graphics, specific information about the format at Windows Bitmap or whatever, and Bitmap redirect to raster graphics with a disambig notice at the top. Where's the downside to such a plan? (The most "common" or "logical" use of the word "bitmap" is certainly not to refer to the format, which is generally called "windows bitmap" or "bmp" or similar) --jacobolus (t) 21:56, 19 September 2007 (UTC)
The "downside to such a plan" is that generally, the order in which Wikipedia articles are written is that first, the article is written and second, there's a big argument to rename it. Here, there's an argument to rename an existing article based on what appears to be the possibility of writing a new article with a broader scope. And it all seems to be hinged on a rather weak understanding of Wikipedia's policy towards disambiguation pages. What we need right now is either for someone to do a comprehensive job of repurposing this article, or for it to be left as-was (where it presented what was at least a fairly clear, unambiguous picture of part of the story). Chris Cunningham 22:08, 19 September 2007 (UTC)
No, I'm not suggesting anyone write a new article with a broader scope. I'm suggesting redirecting the location bitmap to raster graphics, and merging any relevant information about comparisons of bitmap storage schemes into there, and moving the information about the windows file format to an article specifically focused on that, called something like Windows Bitmap or Windows and OS/2 bitmap. If there's more information to put about bitmap storage schemes than can fit in the raster graphics article, it should be put in an article that accurately reflects its content; bitmap should still redirect to raster graphics. --jacobolus (t) 22:16, 19 September 2007 (UTC)
Fair enough, at least that's a concrete proposal. Feel free to start a move request in a new section. Chris Cunningham 07:52, 20 September 2007 (UTC)
I would support such move, too. Of course Windows and OS/2 bitmap is far better than Windows bitmap (see history of renaming).
Side note, not concerning our main discussion: I've checked most reliable source, and it's pretty clear that Microsoft is all about meaning 2. Not meaning 1. That means BMP file is just a container, and it is only if you load full content into memory (WinAPI LoadBitmap() function) when it becomes a "Microsoftian bitmap", as bitmap=header+palette+bit_array. Todo later, after cleanup. --Kubanczyk 09:34, 20 September 2007 (UTC)
It's not going to "Windows and OS/2 bitmap" because, for the umpteenth time, Wikipedia does not place articles at their most pedantic possible titles as a rule of course. And again, no move until there's a reasonable general article at bitmap or a strong consensus to point this article at raster graphics. But I eagerly await a constructive rewrite in any case. Chris Cunningham 11:40, 20 September 2007 (UTC)
Bitmap (BMP)? Isn't it a decent title for meaning_2_article? I oppose "Windows bitmap". --Kubanczyk 12:19, 20 September 2007 (UTC)
I'm tired of repeating myself. When there's a rewrite, a move / rename of what's currently here is a useful expenditure of people's time, and not until. Chris Cunningham 13:16, 20 September 2007 (UTC)
Don't we need to decide what to call this article if bitmap is going to be redirected to raster graphics. That means this article has to have a new title. You agree with someone starting a move request above, but that cannot be done until a decision is made on what to move it to. If the article goes back to being just about 'Windows bitmaps' then all that needs done is a revert and a new title (i.e., there will be no rewrite here). Or am I missing your point? VMS Mosaic 17:10, 20 September 2007 (UTC)
I don't like the premise. Raster graphics is about computer graphics, and appears to be a rather narrow stub of a messed-up article itself. Bitmaps are used not only for graphics but also for photos. What we need to decide is first whether to split out the BMP stuff from the generic bitmap stuff; if so, we need a good title for the BMP article so that we can still have a bitmap article. BMP has had several names before, so we could move it back to one of those, or pick a new one, but bitmap is not it, as the word has a much broader, older, and more well known meaning. Dicklyon 19:50, 20 September 2007 (UTC)

Well that would be fine with me. It just seems like whatever bitmap ends up being or redirecting to should have a general discussion, rather than diving immediately into the arcana of pixel storage, or into the specifics of one particular format. Raster graphics has the start of such a discussion, and though as you say, it's a pretty bad article at the moment, it could be refocussed and generalized somewhat. --jacobolus (t) 20:08, 20 September 2007 (UTC)

So, first we all need to agree that bitmap should point somewhere else. I say it should. VMS Mosaic 20:19, 20 September 2007 (UTC)
Since this discussion have been a blah-blah circle with non-decreasing diameter, I'll be back next month and I'll be bold in article improvements. --Kubanczyk 09:36, 22 September 2007 (UTC)

OK, here's what I'll do, unless I get a specific alternative real soon:

  • Move this article to BMP file format and back out the generic bitmap stuff
  • Creat a new Bitmap article and put the generic stuff into it, with a main link to BMP file format in a greatly-reduced section on the DIB and BMP stuff.
  • Add words to both bitmap and raster graphics to refer to each other and to distinguish their content. The former is about image represenation, the latter more about CG image creation techniques, I think. We can still consider a later merge if that doesn't work out.

Dicklyon 17:58, 22 September 2007 (UTC) There, I did the fork. Now we can independently work on the two articles to focus on what they're supposed to be about. Dicklyon 18:43, 22 September 2007 (UTC)

Palette error?[edit]

The text claims that the color palette size is variable, depending on the number of colors actually used in the image. Is this true? I can find no evidence for it. I placed fact tags on the portions that need to be checked and probably corrected. And is it true that the number of bytes per palette entry differs between Windows and OS/2? Strange, I though we had a standardized format... Dicklyon 16:45, 23 September 2007 (UTC)

Yes, the article is accurate. I tried to reference the items, but someone else could probably do a better job. The sentence "For each byte, a value of 0 indicates that the corresponding color (either red, green, or blue) is not used to create the current image color." is just stating that 0 means zero intensity. The next sentence then states that 255 means full intensity. I don't see any explicit mention of the meaning of 0 and 255 in the references I checked probably because it is common usage for RGB data.
If a format specified by Microsoft (excepting the OS/2 versions) can be considered a standard, then yes, it is standardized. See the section 'Bitmap information (DIB header)' which lists the five different versions of the 'standard'. VMS Mosaic 00:06, 24 September 2007 (UTC)
You seem to be missing the point. Zero for zero intensity is of course allowed in a color, such as [0,0,0] for black or [0,0,255] for blue. But it never means unused, and if it did, how would the table format vary and allow fewer bytes to be stored when fewer colors than 2^n are actually used. I think it's nonsense. Dicklyon 01:59, 24 September 2007 (UTC)
Yes, it is poorly worded. I had intended to say that it needed redone or simply deleted (given that it is a poor attempt at stating the obvious). VMS Mosaic 02:25, 24 September 2007 (UTC)
Sorry about missing that OS/2 V2 switched from three to four bytes per palette entry. I should have caught that. VMS Mosaic 02:39, 24 September 2007 (UTC)
I've done a lot of detail clarification in the sizes, specs, tables, descriptions, etc. Please check and see if I got anything wrong; I did get things wrong and reverted them a few times in the process, so might still have incorporated some misconceptions instead of accurately representing this bizarre and broken set of ancient crufty formats. Dicklyon 02:50, 24 September 2007 (UTC)
@Dicklyon: The documentation says everywhere that the color table can contain ‘up to nnn entries’ (with nnn dictated by the bit-depth). Of course the system needs to allocate the full colour table in case the header lies about the actual contents of the bitmap data, which would be very hard to verify considering that programs may change the bitmaps they use in memory while they are running. Maybe it initializes palette entries not present in the file with black? Shinobu (talk) 16:26, 19 December 2008 (UTC)
Looks like we took care of this and got it propertly referenced a while back; the table size can indeed vary, but on reading into a DIB the max-size table will be allocated. Dicklyon (talk) 16:46, 19 December 2008 (UTC)

Not in proper context[edit]

This page is clearly not in proper context. It needs a lot of re-phrasing now. With all due respect, I would propose non-experts to temporarily restrain from editing. I'll repeat an important link to Microsoft documentation. It's pretty clear that Microsoft is all about meaning 2. Not meaning 1. That means BMP file is just a container, an auxiliary thing. It is only if you load full content into memory (WinAPI LoadBitmap() function) when it becomes a "Microsoftian bitmap", being bitmap=header+palette+bit_array. It is a "bitmap", and not a "BMP", what is a crucial component of API. --Kubanczyk 08:03, 24 September 2007 (UTC)

Sorry, but "meaning 2" is bit too indirect at this point, since I can't find a numbered list. But feel free to work on it. When the bitmap from a BMP file in is memory, it's called a DIB, by the way, so let's use that in preference to the generic term bitmap where it applies. Dicklyon 14:17, 24 September 2007 (UTC)
The expert tag is not likely to help unless you say more here about what you think is wrong or what is needed. It seems to me that the article does a good job of covered the topic spelled out in the title and lead. If you're saying you want the topic expanded to be more about DIBs in memory, then say so clearly, or just do it; you may want to move the article again if that's what you have in mind. And the link you provided as a clue just gets me a Microsoft server error. Dicklyon 14:22, 24 September 2007 (UTC)
I'm sorry, I'm not an expert myself. I only programmed GUI in API for about a year and it was long time ago. I'll try to refresh my info, but I'm a bit busy now. What you call "DIBs in memory" is the key point here, not an expansion anyway. Link corrected. --Kubanczyk 16:22, 24 September 2007 (UTC)
I think the article content matches the title. I support non-Windows web browser code which handles all five versions of this format (and maintain the web page of example BMP images linked to by the article). I believe the audience for this article is anyone who wants/needs to understand the internal format of BMP files (i.e., it is not intended specifically for Windows programmers), therefore it should not have a Windows centric viewpoint as might be provided by a Windows 'expert'. VMS Mosaic 21:25, 24 September 2007 (UTC)

Byte order and bit order[edit]

"all integers are stored in little-endian format": O RLY? This may be true for the order in which the bytes of words and dwords in the header are stored, however, for the actual pixels the story is entirely different. For two-colour images, the bits should be read from most significant to least. Similarly, in 16 colour images the most significant halves precede the least. Similarly, for true-colour images, the order is blue, green, red. Considering that the standard Windows colour definition is ffbbggrr16 where ff are two hex digits containing flags, bb two hex digits containing the blue value, etc. Would you save this as little-endian, it would appear like rr, gg, bb, ff. Note that ff is not saved to bitmaps since it's only used when specifying system colours and such, which are converted to RGB-only colours when drawn. So it appears that the actual image data saved is big-endian. (See ms-help://MS.PSDKXPSP2.1033/gdi/bitmaps_1rw2.htm in the Platform SDK for confirmation.) Shinobu (talk) 23:11, 17 February 2008 (UTC)

Bitmap history.[edit]

Who created it, how old is it, etc. —Preceding unsigned comment added by (talk) 07:51, 10 March 2008 (UTC)

Yep, that certainly needs to be there. I recommend this article that goes into a lot of detail, including the evolution of the various structures. I think we can use that as a cite when we add information to this article. Shinobu (talk) 04:16, 14 March 2008 (UTC)
Where are any references to a specification for the Windows .bmp file format? Links to copies of the original spec aren't good enough if they don't cite their sources. What happened to 'verifiability'? I can't verify these copies against an original. Compare with the article on GIF for instance which does give a link to the specification. Nick 3216 (talk) 10:06, 28 July 2008 (UTC)
Well, if I understand correctly, the BMP format got started as a simple dump of a bitmap structure + data, preceded by a header. So that would mean the original specification would be the relevant structure (BITMAPCOREHEADER) in the relevant OS/2 and Windows header files, the documentation for which is now at ms-help://MS.PSDKXPSP2.1033/gdi/bitmaps_7jaq.htm in the Platform SDK. (This format was extended several times.) Before that only device dependent bitmaps were used, which were also essentially just a simple dump of a bitmap structure, this time BITMAP (the documentation for which is now at ms-help://MS.PSDKXPSP2.1033/gdi/bitmaps_2h6a.htm) except instead of the pointer to the data the data is written to the file. That, and books etc. written by third parties, is as close as we're going to get. Remember that we're writing 1985 here. Shinobu (talk) 16:04, 19 December 2008 (UTC)


Hi. For 1 bit bitmap rowsize should be : "The width of a pf1bit Scanline in bytes is Bitmap.Width DIV 8 if the width is a multiple of 8. If width is not a multiple of 8, use the following to calculate the number of bytes: 1 + (Bitmap.Width-1) DIV 8"[2]. For example for Width = 1000 this gives 125 ( good result), while equation floor((Width+31)/32)*4; gives 128 ( bad result). What do you think ? --Adam majewski (talk) 16:17, 8 May 2008 (UTC)

  1. ^ . januari 2011  Check date values in: |date= (help); Missing or empty |title= (help)
  2. ^ efg's Manipulating Pixels With Delphi's ScanLine Property
Your ref is a dead link. Microsoft says the scanlines are dword aligned, so the formula in the article is correct and yours if wrong, if that's so. Dicklyon (talk) 17:58, 8 May 2008 (UTC)

You are right, link has an error. I have removed eror from link. It works now , but ... your link shows blank page (?) --Adam majewski (talk) 18:42, 8 May 2008 (UTC)

The bit you quote does not appear to be talking about BMP format, but about some other structure. The MS link works for me. Dicklyon (talk) 20:34, 8 May 2008 (UTC)

I have checked your link in IE and it works. It does not work in firefox ( blank page). SO how you will comment example above: compute row size for width pixel by 2 above methods and tell me what you get or where I have made an error . (:-)) --Adam majewski (talk) 06:36, 9 May 2008 (UTC)

You have not made an error; but the formula you're using may not apply to BMP format. Dicklyon (talk) 07:07, 9 May 2008 (UTC)

Naming conventions for image file formats[edit]

Please see the discussion at Talk:Image file formats#Naming_conventions_for_image_file_formats on naming conventions for articles on image file formats. Dcoetzee 00:47, 25 October 2008 (UTC)

Bitmap Data Example[edit]

I've been trying to add an example of the bitmap data, but it seems my efforts are not appreciated. What exactly is wrong with what I added? It is meant to be the pixel data after the 54 byte in the bitmap file. Dicklyon, I'd appreciate a more constructive comment than "this is wrong". While the text in the paragraph is somewhat clear, it doesn't go into detail about how the bits are stored in the file (i.e. what comes first blue, red, or green). I thought this example would be useful for someone who is writing a program that reads a bit map, which is what I've been doing.

Example of a 2x2 Pixel Bitmap, with 24 bits/pixel encoding
Bitmap Data Example using a 2x2 Pixel, 24-Bit Bitmap
Offset Size Hex Value Value Description
0 2 42 4D "BM" Magic Number (unsigned integer 66, 77)
2 4 46 00 00 00 70 Bytes Size of Bitmap
6 2 00 00 Unused Application Specific
8 2 00 00 Unused Application Specific
10 4 36 00 00 00 54 bytes The offset where the bitmap data (pixels) can be found.
14 4 28 00 00 00 40 bytes The number of bytes in the header (from this point).
18 4 02 00 00 00 2 pixels The width of the bitmap in pixels
22 4 02 00 00 00 2 pixels The height of the bitmap in pixels
26 2 01 00 1 plane Number of color planes being used.
28 2 18 00 00 00 24 bits The number of bits/pixel.
30 4 00 00 00 00 0 BI_RGB, No compression used
34 4 16 00 00 00 16 bytes The size of the raw BMP data (after this header)
38 4 13 0B 00 00 2,835 pixels/meter The horizontal resolution of the image
42 4 13 0B 00 00 2,835 pixels/meter The vertical resolution of the image
46 4 00 00 00 00 0 colors Number of colors in the pallet
50 4 00 00 00 00 0 important colors Means all colors are important
Start of Bitmap Data
54 3 00 00 FF 16,711,680 Red, Pixel (0,1)
57 3 FF FF FF 16,777,215 White, Pixel (1,1)
60 2 00 00 0 Padding for 8 bytes/row (Could be a value other than zero)
62 3 FF 00 00 255 Blue, Pixel (0,0)
65 3 00 FF 00 65,280 Green, Pixel (1,0)
68 2 00 00 0 Padding for 8 bytes/row (Could be a value other than zero)

--Craig t moore (talk) 16:41, 17 November 2008 (UTC)

It looks interesting for me. I think that all bitmap data should be in that table. Also different types of bitmap ( pf1bit, pf8bit ...)--Adam majewski (talk) 19:21, 17 November 2008 (UTC)
Ok, It would not be difficult to include the header information in this example. I'll try to do it later tonight. What other types of encoding would be illustrative? I'm a bit hesitant to add additional examples since it would get rather cluttered if we included too many. I would like confirmation from someone if the data in this table is correct though. Otherwise, I do not think it will last long on the page. --Craig t moore (talk) 20:55, 17 November 2008 (UTC)
Maybe wikibooks is a good place for it ? --Adam majewski (talk) 21:11, 17 November 2008 (UTC)
I've gone ahead and added the header information to the table. Now that it includes all the information stored in the file, should it have its own section? I haven't looked, but is there a wikibook on bitmaps? In my opinion, I think it should be here. It illustrates everything that was discussed in the sections above in a small example. --Craig t moore (talk) 22:45, 17 November 2008 (UTC)
Well, there are various problems with it, which is why I suggested you work it out here first. The "clear as mud" comment was partly about how your bits are formatted as nibbles, so the bytes are not apparent (the mixed-endianness of the bit sequences makes this particularly confusing); getting rid of the binary and just keeping the hex would be a partial fix to this, I think. The "incorrect" was referring at least to your padding of 6 bytes out to 12, instead of 8, which I see you have now fixed above. Also, some of your bits don't agree with your bytes (like the 24). I haven't checked much more yet, but this is the place to do it. Note also that the padding bytes need not be 00, according to the article. Dicklyon (talk) 04:56, 18 November 2008 (UTC)
Well I find it useful to format binary in 4-bit segments since its easier (for me) to read which is why I put them as nibbles. As far as mixed-endianness, I am not sure what is mixed up about it? I read the file in hexl-mode in emacs and that is exactly as it appears if you created the file using gimp. I agree with you though that the binary is over kill so I've removed it, and I was actually thinking about removing it anyway. What other values (besides zero) are there? Maybe we could put a note in that row stating what those values could be?
Filler values are arbitrary. You could indicate that with XX for example. Dicklyon (talk) 16:37, 19 November 2008 (UTC)
I found the table very useful in clarifying the meaning of the description. I notice one difference between the table shown above (in the talk page) and the table present in the article itself. The talk page table uses (x,y) coordinates, while the article table uses (y,x) coordinates. That is, the horizontal part is described first in the talk page table, in line with convention. Is the use of vertical part first in the article table accidental? This is my first post so please let me know if anything about it should be different. Thank you. SuperfluousAutomaton (talk) 09:06, 1 September 2010 (UTC)
OK, I've fixed this. Ippopotamus (talk) 18:57, 1 September 2010 (UTC)
The 2-byte field at offset 28 has a 4-byte hex value; should be just "18 00". Mossd (talk) 19:30, 8 September 2010 (UTC)
Also, at 34 I think the first byte should be "10". Mossd (talk) 21:07, 8 September 2010 (UTC)
I guess the example is no longer controversial after 6 years, but it was the single most useful resource for me this week! 16 Dec 2016 — Preceding unsigned comment added by (talk) 04:38, 17 December 2016 (UTC)

Prescriptive advice removed[edit]

User: asks me via off-wiki email re his edit that I largely undid:

I was wondering why you removed my most of my edit ?
Is it that you do not wish people to easily understand how to access data?
If my information is incorrect fine but you removed the information that I found the hardest to locate on the web so I thought it would be helpfully to have it available to all.
Please respond I am interested in improving my post.

In my edit summarized as "remove prescriptive advice and copyedit the new material," I took out the code examples and statements like "To access the data simply read each char and then grab the first 4 bits and then the second 4 bits" as being too prescriptive. See WP:NOTHOWTO. I also tried to fix a lot of redundancy and poor expository order. If I dropped anything important, please do put it back. Dicklyon (talk) 16:33, 15 December 2008 (UTC)

For this sort of thing we should really either provide tables or link appropriate specifications. It doesn't make sense to describe how to parse a file format in English prose. Dcoetzee 02:48, 16 December 2008 (UTC)
Also not so helpful in C code, in my opinion. I think there's plenty of info in the article already, so anyone competent could write code as needed; and the relevant docs are referenced already. Dicklyon (talk) 03:00, 16 December 2008 (UTC)
I've added an explicit English statement of the endianness of pixels within bytes, with link to the doc that says so. If I got this right, the code that I removed for the 1-bit case was probably wrong, as it appears to assume that 32-bit values are big-endian in the file, which is backwards, no? Was the code tested? Do I misunderstand it? Dicklyon (talk) 03:12, 16 December 2008 (UTC)


The support of per-pixel-alpha in BMP files and in CF_DIB or CF_DIBV5 bitmaps on the Windows clipboard (which are supposed to have an identical format to BMP files, just without the BMPFILEHEADER) is very vaguely documented by Microsoft, and it is hard to find sample files. Anybody have any pointer to some definite documentation and sample files?

I have been hacking on support for copy-pasteing of images with alpha between GTK+ and other apps on Windows this weekend, and am really getting sick of this. It seems that when copying an image with alpha (from a PNG) from Firefox or IE7 to the clipboard, the 32-bit DIB one then in another app gets from the clipboard is of 32-bit BI_RGB type, and the "extra" bytes are in fact alpha. However, the alpha is premultiplied in the rgb bytes! Nowhere is this documented as far as I know?

I have not managed to programmatically produce any kind of trivial test bmp file with partial transparency that would look correct when inserted into Word or Powerpoint 2007, or viewed in Explorer, IE7 or Firefox. Not even files with 32-bit V5 (BITMAPV5HEADER) data in BI_BITFIELDS format that to the best of my knowledge should be the only BMP or DIB format that documentedly and unambiguously can store per-pixel-alpha work. Sigh...

Oh well, luckily at least MS Office 2007 also offers images copied to the clipboard in unambiguous PNG format. TorLillqvist (talk) 22:17, 18 January 2009 (UTC)

You might be interested in wikia:vb:How to draw the mouse pointer dynamically.frm. It dynamically creates a bitmap with per-pixel-alpha for use as a cursor. Additionally, you could take apart Windows theme files, they are DLL's that contain images with per-pixel-alpha. As you mention BMP uses premultiplied alpha, this is common in the case where it's likely that they have to be drawn without hardware accelleration. For extensive information on BMP files, the corresponding objects in memory, and the concepts and functions involved, please consult the Platform SDK, it has a chapter on bitmaps. Oh, and as a footnote, that Windows supports something doesn't necessarily mean that (badly written) applications support it. (talk) 14:21, 13 March 2009 (UTC)
I just discovered that Windows' SystemParametersInfo function doesn't support new style bitmaps. :-) (talk) 22:39, 4 October 2009 (UTC)

Merge and extend tables[edit]

The table for the OS/2 V1 header is just a subset of the Windows BMP header. The tables should be merged and this should be indicated. In a similar fashion, the tables should be expanded to cover the newer formats as well. (talk) 14:25, 13 March 2009 (UTC)

Yes, but the OS/2 V1 make use of 16-bit values for width and height. Therefore, the following cast make no sense:
This would result in

since theire offsets are different.

BTW, what does BITMAPCOREHEADER2 look like. I can not find any information about this struct. —Preceding unsigned comment added by (talk) 18:01, 31 May 2009 (UTC)

There are only five values that are different in OS/2, surely we can add them in brackets or something? (talk) 22:43, 4 October 2009 (UTC)

Padding bytes?[edit]

In the bitmap data section, it states, "A bitmap with width 1 would have 3 bytes of padding, width 2 would have 2, width 3 would have 1, and width 4 would not have any at all." This seems as if it is referencing bitmaps with widths of 1, 2, 3, and 4 pixels, respectively. If the bitmap had a width of 1 pixel, there would be 3 bytes of data for blue, green, and red. To pad it to 4 bytes, only a single padding byte would be required. With a width of 3 pixels, there would be 9 bytes: red, green, blue, red, green, blue, red, green, blue. To pad this to a multiple of 4 bytes would require an additional 3 bytes, not just 1. I created a 3x2 image to test this, and there were, in fact, 3 padding bytes added per line. Should I correct/clarify the article? -- (talk) 20:51, 27 July 2009 (UTC)

I checked another, 24-bit BMP, and I saw no padding. Each pixel was stored as three bytes, as blue, green and red respectively. No 32-bit padding. This made things both easier and memory efficient. And I was using Windows XP, does it count? Then again the bitmap was 64x64 in size, does that also count?--Printz150 (talk) 10:30, 17 September 2009 (UTC)
Lines are padded to a 32bit or 4byte or "full word" boundary: that is, a line of 24bit BGR pixels with 10 pixels per line would have 30 bytes for the 10 pixels of three bytes each plus 2 bytes padding to a 32 byte line. Now the 3 pixel line would be 3 * 3 = 9 bytes for the image line, padded to 12 bytes. If the number of 24 bit pixels is a multiple of 4 in the first place, as with 64, no padding is required. integer (pixel-per-line * bits-per-pixel + 31 / 32 ) * 4 = bytes per read/write line for BMP format. Think of it this way: the lines are read or written a full 32-bit word register at a time, whether the bits per pixel are 1, 4, 8 or 24, so all lines have to end on a 32 bit or 4 byte boundary. Naaman Brown (talk) 19:08, 22 September 2009 (UTC) correct that math Duh (reminder to self: Show preview Then Save page Naaman Brown (talk) 11:26, 23 September 2009 (UTC)~

Padding of all rows is mandatory in RAM, however inside a file, the padding of the last row is optional. The padding of other rows in a file is mandatory because there is no flag in the bitmap headers to differentiate padded rows from unpadded rows.
Verpies (talk) 11:29, 25 November 2010 (UTC)

Bitmap Run Length Encoding[edit]

Why no discussion of Windows Run Length Encoding (RLE) and the compressed .BMP format .RLE? Naaman Brown (talk) 18:45, 22 September 2009 (UTC)<>

I could add a section on bitmap compression if nobody objects. Also since we also document the BITMAPCOREHEADER2, should I document the obsolete Huffman 1D and RLE-24 compression, too ?
I just like to get your opinion about NOT including BI_BITFIELDS as one of the bitmap compression methods, because it does not decrease the image size in any way - it merely defines the pixel formats.
Verpies (talk) 11:24, 25 November 2010 (UTC)

BMP line order[edit]

To me the most unusual characteristic of the BMP format is that the pixel lines are stored in bottom up order. Years ago I wrote a program to convert .IMG scan files produced by WIPS software for a Xerox Datacopy 730 scanner to .PCX run length encoded for file export via floppy diskette. I added support for .BMP and .RLE formats. The first thing I discovered was that the "first" scan line in the .BMP file is the bottom line of pixels in the image (whereas in the .IMG and .PCX format the first scan line in the file is the top line). Naaman Brown (talk) 14:57, 24 September 2009 (UTC)

4x2 Pixel, 32bit Bitmap Example[edit]

Should I add an 4x2 Pixel, 32bits (BGRA) bitmap example? (talk) 06:05, 30 October 2010 (UTC)

Added it anyways Xp ~kotarou3 07:45, 30 October 2010 (UTC)
Very nice, I could use it for "Portable Arbitrary Map" (PAM) format on Netpbm. –Be..anyone (talk) 15:54, 11 March 2014 (UTC)


Do you think that a section of different BMP image file format implementations should be added ?

MS-Paint, MS-PowerPoint, Photoshop, InternetExplorer, Firefox, Google Chrome each use a different implementation of the BMP standard.
These different implementations are often non-compliant with Microsoft's documentation and produce BMP files with different quirks that are often incompatible with other applications.
Would it be beneficial to developers to document those quirks and incompatibilities?
Verpies (talk) 11:16, 25 November 2010 (UTC)

Probably those quirks are caused mostly by Microsoft's inconsequential and low-quality documentation and standard itself (I mean primarily the mess with redundant bit fields in versions 4+ and uncertainty with possibility to use intermediate (non-integer) versions of the header). So it would be nice if you mention the documentation issues as well.
BTW, different implementations are still quite compatible with each other. —Ippopotamus (talk) 23:16, 25 November 2010 (UTC)

I appreciate your feedback. I would like to mention the shortcomings of Microsoft's documentation. As of now I lack an appropriate section where I could put it.
Could you elaborate what you mean by:
1. Redundant bit fields in DIB Header of version 4 and above ?
2. Non-integer versions of the DIB Header ? (are there more than 7 versions, total ?)
Verpies (talk) 16:16, 29 November 2010 (UTC)

First, I'd like to comment the information you got from that Adobe employee. Not sure if he is a reliable source, and I think the existence of BITMAPV2INFOHEADER and BITMAPV3INFOHEADER outside of Adobe source code is highly unlikely. Moreover, I think that the version number of BITMAPINFOHEADER is 3 (not 1), since the version numbers were always synchronized with numbers of Windows versions required to support them.
1. "Redundant bit fields in DIB Header of version 4 and above": oh, I actually meant redundant bit field masks; Microsoft added ARGB masks in the V4 header, but still clearly requires three DWORDS with RGB masks after the header for bitmaps with BI_BITFIELDS compression. Practically, those obsolete masks seem to be generally not included in BMP files, but they are still required for packed DIBs to work correctly.
2. "Non-integer versions of the DIB Header": since
a) there is no version number identifiers in the BMP/DIB data structures,
b) new fields in a new header version always arrive strictly to the end of the previous version,
c) there is a "header size" field in the header,
we (theoretically) can put aside all these version numbers and just use the required number of header fields. Actually, Adobe and others successfully do this for many years.
Ippopotamus (talk) 21:57, 29 November 2010 (UTC)
I did get the names of the 52 and 56 byte headers from that Adobee employee. I used to call them differently but I decided to use his names and treat him as a reputable source, since he is the guy that actually dabbles in the source code of such major application as Adobe Photoshop. The 56 byte DIB Header that this application generates is incompatible with MS-Office, Chrome, and many others. It is a major interoperability problem. I have even written a utility in C that converts these non-compliant files to compliant ones with the current Microsoft documentation.
Great. You trust a person which involved in creating an application which produces highly incompatible files :)
I personally prefer Pixelformer for creating BMP images; looks like its implementation does not have major issues with compatibility.
Ippopotamus (talk) 00:28, 30 November 2010 (UTC)
Regarding the redundant bit field masks, I think that Microsoft corrected their documentation and requires bit filed masks to follow only the BITMAPINFOHEADER when biCompression == BI_BITFIELDS.
See [3] -- Verpies (talk) 00:02, 30 November 2010 (UTC)
I see no signs of that. And CF_DIBV5 (a clipboard format with packed DIB V5) does not work correctly without those extra DWORDs, even on Windows 7. —Ippopotamus (talk) 00:28, 30 November 2010 (UTC)
According to the reference I had given, this problem does not exist for BITMAPV4HEADER. However you are right about the redundant bit field masks in BITMAPV5HEADER. Apparently this is a "documented" bug. Indeed, this is a big problem for the clipboards operations with the CF_DIBV5 format. Did you try calling SetClipboardData(CF_DIB,...) with biCompression == BI_BITFIELDS followed by GetClipboardData(CF_DIBV5) to see how Microsoft converts between these formats? See "Synthesized Clipboard Formats" [4]
Verpies (talk) 21:12, 30 November 2010 (UTC)
AFAIR, Windows kept these three DWORDs after clipboard format conversion. But since such experiments were slightly aside from my primary goal and I cannot guarantee that I'm 100% correct, someone should recheck this. —Ippopotamus (talk) 21:52, 30 November 2010 (UTC)
OMG! I just checked and it's true. The WinXP clipboard converted [5] the BITMAPINFOHEADER with biCompression == BI_BITFIELDS to the BITMAPV5HEADER with bV5Compression == BI_BITFIELDS and 3 DUPLICATED bit field masks (beyond the BITMAPV5HEADER boundary ). It gets worse - the inverse clipboard conversion [6] done by copying memory and calling SetClipboardData(CF_DIBV5, ...) followed by GetClipboardData(CF_DIB) does not restore the original bitmap. The 3 bitfield masks appear TWICE (6 bitfield masks total!), after the BITMAPINFOHEADER and as a consequence the first entries in the Pixel Array are not pixel values but this second set of 3 bit field masks. This causes the whole bitmap to be shifted by 12 bytes when it is pasted anywhere. This is not a quirk - this is a BUG.
Verpies (talk) 16:34, 1 December 2010 (UTC)

In addition to V5 Header, those are the current possible Microsoft header configurations with bit field masks:

All Windows Header configurations

Note that I treat the bit field masks (orange) as part of the DIB Header instead as a part of the Color Table. In my mind each of these 5 columns can be substituted for the BITMAPV5HEADER, in agreement with the statement in the Diag.1 of the main article: "Older DIB Headers can be substituted for the BITMAPV5HEADER". Of course the OS/2 Headers can also be substituted for the BITMAPV5HEADER in Diag.1.
I know that IE has a bug that makes it seem like it is expecting the bit field masks any time Compression == BI_BITFIELDS, but in fact, this is another problem arising from IE not respecting the BITMAPFILEHEADER.bfOffBits field. See: [[7]]

Your point 2c is in conflict with Microsoft docs:
"bV4Size - The number of bytes required by the structure. Applications should use this member to determine which bitmap information header structure is being used."[[8]]
Also, I wouldn't get very far with using only the first 4 fields out of the DIB Header, because bV4BitCount member is essential for most bitmap operations and it is the 5th field. Ergo, the "header size" field cannot be treated as a simple valid field counter.

I primarily meant the transition between BITMAPINFOHEADER and BITMAPV4HEADER. If we just want a legal alpha channel, why should we add the color space and gamma information? Yes, docs do not allow header truncation directly but format itself does. Seems Adobe yielded to temptation and, as you could see, now believes that Microsoft allowed them to use the intermediate headers. And practically we already cannot always follow the docs, because we probably want to decode files created by Adobe Photoshop (which is a quite popular tool). —Ippopotamus (talk) 00:41, 30 November 2010 (UTC)
If one is decoding a BMP oneself then it makes sense to accept the BITMAPV3INFOHEADER and other 'truncated' headers, but often a Windows application will simply offload the decoding to the LoadImage API, and that does not accept such files. I think the article ought to emphasise more strongly that the validity of BITMAPV3INFOHEADER is disputed and its use will impair compatibility. —RichardRussell 18:04, 22 December 2011 (UTC)

Obviously there is no conceptual need to add color space and gamma information if only legal Alpha channel is desired. Fortunately V4 and V5 DIB Headers allow for omitting the Color Space and Gamma information by specifying ..CSType == LCS_WINDOWS_COLOR_SPACE (or LCS_sRGB), albeit the relevant Color Space and Gamma fields remain present in the DIB Header, taking up space as ignored fields.
By their mere clout due to company size and the popularity of Photoshop, Adobe has created a new BMP file standard by the sheer usage of the undocumented 56 byte DIB header. As you have seen, their employee believes that they did nothing wrong and ignores the fact that MS-Office, Chrome, etc... cannot even open these files. This is in addition to other bugs such as their miscalculation of File size, Pixel Array size, BITMAPV3INFOHEADER.biSizeImage and BITMAPFILEHEADER.bfSize fields [[9]].
Also the illegal and ambiguous generation of their 32bpp bitmap files with Alpha channel where Compression == BI_RGB, and without Alpha channel where Compression == BI_BITFIELDS, is the exact opposite to what it should be and make it impossible to discern Photoshop 32bpp bitmap files with and without Alpha ch. (even pixel scanning cannot distinguish them when all pixels have Alpha == 0. PS treats them as Alpha == 255, then !. Total mishmash).
To add insult to injury I think Adobe's RLE compression encoder skips a middle column of pixels, distorting the image stored in a file.
Verpies (talk) 14:42, 1 December 2010 (UTC)

Point 2b is true only if the OS/2 headers are not considered.

Point 2a is debatable because in MS API the size of headers is always synonymous with the version of headers. Microsoft even adds dummy reserved fields when two structures with different field meanings would have the same size, to keep their versions/sizes distinguishable.
I think we should follow MS docs since they invented the damn thing...
Verpies (talk) 22:54, 29 November 2010 (UTC)

I got the same headers right off of Microsoft's website back around 1998 for some Windows CE code -- so, yes, they are used outside of Adobe, and even outside Microsoft. But I can't find them all documented on Microsoft's current public website, even with MSDN membership access. And, sanity check: if Microsoft had a problem with Adobe's files, wouldn't they let someone know about it in the past 10+ years? (talk) 01:53, 2 February 2014 (UTC)

BI_ALPHABITFIELDS sanity check[edit]

The image is interesting, but I'm not sure how to interpret it: Apparently the 2nd part matches the 4th part, and the 3rd part matches the 5th part. Part 4+5 explain that the different header formats correspond to compression BI_ALPHABITFIELDS vs. BI_BITFIELDS. So actually there are only three variants for the purposes of this image, V2 without alpha mask needs BI_BITFIELDS, V3 with alpha mask needs BI_ALPHABITFIELDS, and V4 can handle everything. The EGFF page has V3 as "version 3 for NT", and explains that compression has to be 3 if bitfield masks are used. EGFF also has V4, adding alpha mask bits + color space fields.

A Mozilla BMPFileHeaders.h page claims 4 instead of 3, that sounds plausible — 3 vs. 4 bit field masks corresponding to format version 3 vs. 4, and maybe also Windows NT 3 vs. NT 4. But the article says BI_ALPHABITFIELDS 6, with JPEG 4 and PNG 5. EGFF is too old for this detail. For the GIMP value 4 and all alpha code was removed with extreme prejudice in 2012, because they found no working BMP using this feature in the wild.[10] Well, and I find no official header file with the exact value. I've added a citation request for now.

Assuming that BI_ALPHABITFIELDS exists outside of dead CE platforms, and is in fact 6 (or 4, whatever works), the image here could be trimmed to its parts 1+4+5 (parts 2+3 would be redundant) and added to the article, full width. –Be..anyone (talk) 19:35, 11 March 2014 (UTC)

In 2010 BI_ALPHABITFIELDS was not defined in wingdi.h, and in 2014 Windows Metafile revision 11 also does not support it. –Be..anyone (talk) 03:57, 12 March 2014 (UTC)

Move to Device Independent Bitmap[edit]

I was not trying to imply that the extensions were of equal weight. I moved the page to Device Independent Bitmap for several reasons, the biggest of which is that this is what the format is actually named. Look at the articles of GIF (Graphics Interchange Format), PNG (Portable Network Graphics) TIFF (Tagged Image File Format), XBM (X BitMap) etc. The most common name for this file format is not "BMP file format", or even "Device Independent Bitmap". The most commonly used name to describe this image format is simply Bitmap. The problem is that is also a hugely-broad term that incorperates all raster graphics, and so this page and that one have several crossed wires. And seeing as how this article cannot be at bitmap because it would cause too much confusion, and BMP isn't specific enough (and doesn't match the naming convention of other image file formats), the article should be at its actual proper name Device Independent Bitmap. I agree that .DIB was not in common use for very long, but that doesn't change the fact that both .DIB and .BMP both stand for Device Independent Bitmap. ▫ JohnnyMrNinja 10:06, 12 February 2011 (UTC)

And actually take a look at the links used as refs at the bottom of the page, and you'll notice that the format is only ever referred to as a "Device Independent Bitmap" or a "Bitmap". I'm a little too tired to go digging through those sources, but I believe some actually reference generic "bitmaps" (raster graphics) and not the format mentioned. ▫ JohnnyMrNinja 10:10, 12 February 2011 (UTC)
Okay, but those names (Portable Network Graphics, &c.) are names whose abbreviations are the commonly used terms. To be honest though I think these articles would probably be better off at PNG and TIFF and XBM, since those are the names typically used. For comparison, there’s an article at JPEG. Anyway though, do you know when the DIB term first appeared? Are files described as DIBs outside of microsoft’s documentation? I don’t really care much where this article sits, but I think you should let Ippopotamus and Verpies and Dicklyon et al. weigh in. –jacobolus (t) 10:36, 12 February 2011 (UTC)
I think that the article placement should be done according to the most popular term, measured by it's usage frequency. I personally concentrate on the technical correctness of the format and I care more about the cross-compatibility of the BMP files between programs than I do about its naming. Verpies (talk)

The DIB name was the name it was proposed with, even when it was just a concept. I have no problem with reaching consensus, but it is insulting to have edits undone in that fashion. The three articles had too much overlap, and that can be confusing to editors. This is the reason that each article has (or had) content that belonged on the others. I'm just trying to put things in their logical place. And yes PNG should be at PNG, but Portable Network Graphics is still better than PNG file format. If you can't have the best title, then choose the second-best, don't just knock-off the best one (if that makes sense). ▫ JohnnyMrNinja 10:45, 12 February 2011 (UTC)
Well I certainly don’t mean to “insult” you. See WP:BRD. As for “undoing” your edits at bitmap/raster graphics: I didn’t actually change any article content there; I just undid the talk page merger (unless one of the topics is particularly relevant such a merger is unnecessary and atypical) – VMS Mosaic undid the rest. –jacobolus (t) 11:41, 12 February 2011 (UTC)
If I recall correctly, all of what I undid went against established consensus. Such significant changes which go against previous consensus need discussion. I see nothing in the current discussion which has changed the previous consensus. VMS Mosaic (talk) 06:05, 10 March 2011 (UTC)
There are no major problems with such names as "Portable Network Graphics" or "Tagged Image File Format", but certainly not all images in BMP file format are bitmaps. 256 indexed color images usually are not (no color planes there), and 24-bit images are not bitmaps by any means. Either move it to something like bitmap (Microsoft), or retain the current title. Incnis Mrsi (talk) 12:00, 1 March 2011 (UTC)
Any image format which contains a one for one pixel representation is a bitmap (per the Bitmap article) in at least a relative sense. See the discussion above where it was argued that a JPEG is a bitmap (I still disagree that it is, BTW). Using the Wikipedia definition of bitmap, then all BMP's are bitmaps. VMS Mosaic (talk) 05:57, 10 March 2011 (UTC)

Lead section[edit]

The lead is too general for a file format and need to include a summary of the rest of the article.

The lead did a very good job of not telling what the file format is, which fails Wikipedia:Manual of Style (lead section)'s lead "The lead should define the topic and summarize the body of the article with appropriate weight.". The file format has a proper lead that says it is a particular way data are stored. However the lead of this article goes into details about where the file format is supported, what can be stored in the format, without definding what the file format actually is? A definition should be able to distingush itself from its peeers, and besides the names everyone knew about, the lead can be applied to basically every other image file format. Quote: "The BMP File Format is capable of storing 2D digital images of arbitrary width, height, and resolution, both monochrome and color, in various color depths, and optionally with data compression, alpha channels, and color profiles.". It is like saying a person in the United States is capable of driving and speak English in the person's wikipedia article.

I made an attempt to put a summary of the rest of article with due weight of their usage freqency in the lead but got reverted for giving up details and duplicating with the rest of the article. So I give up, and let the rest of you decide how best to fix the lead.--Skyfiler (talk) 23:03, 22 May 2011 (UTC)

BITMAPCOREHEADER2 Size and optionality[edit]

On February 8 user David D Allen made a revision in the description of DIB header changing the BITMAPCOREHEADER2/OS22XBITMAPHEADER to a variable size.

Specifically he changed the BITMAPCOREHEADER2 / BITMAPCOREHEADER2 size from 64 to 12-64 bytes making it indistinguishable from the following header types:
...because these header types are differentiated by their size, not by their contents.

Programs that would follow this badly revised documentation would be unable to distinguish between the above DIB Headers. This would generate serious bugs in implementations. Especially for DIBs in memory where the Bitmap File Header is absent.

As someone who created most of this article (and the main illustration), I am announcing my intent to revert this revision, if someone does not provide a good argument or documentation for keeping the DIB header size ambiguity within a week.

Please, note that I will not accept an explanation in the style that "some program XYZ treats some BITMAPCOREHEADER2 fields as optional" as this does not prove anything and individual implementations do not constitute documentation. Even Adobe Photoshop makes serious implementation errors with Alpha channels.

Verpies (talk) —Preceding undated comment added 10:47, 27 March 2012 (UTC).

I say go for it. The less ambiguity and conflicting info, the better. The article has gotten so confusing, I have trouble understanding some of it (and I support a decoder which handles all of the possible BMP formats including the alpha channel). VMS Mosaic (talk) 04:41, 12 April 2012 (UTC)
Verpies (talk)Verpies
Done. As the #1 contibutor to this article I am curious which part of the article is still confusing. I also developed a C code for processing this format. —Preceding undated comment added 11:50, 19 April 2012 (UTC).
For example, the DIB header (bitmap information header) section commentary after the table is confusing and makes little sense in one place even if the bad punctuation is ignored. I say this as someone who has edited this article since 2006. This article reads like a technical standard instead of an encyclopedic article. BTW, I just restored the overly detailed tag. VMS Mosaic (talk) 03:37, 9 May 2012 (UTC)


The 1058 Pixel Wikipedia-logo is a grayscale image, so it i a bad example for a 24bit-BMP, because there is no reason for storing a grayscale image as a 24bit-Full-color BMP instead as a 8bit-grayscale-BMP, it's just a waste of storage space. --MrBurns (talk) 19:56, 2 July 2012 (UTC)

  I agree Verpies (talk)  —Preceding undated comment added 20:15, 6 September 2012 (UTC) 

R.G.B.A.X diagram[edit]

First Wikipedia input, so I didn't want to try to edit anything. There is a comment already from over a year ago at so this is probably simply reiterating, but you're using two R.G.B.A.X diagrams here and they don't layout the field order the same. The first diagram

The BITFIELDS mechanism depicted in RGBAX sample length notation

looks to have the Red and Green fields swapped, based on the BITFIELDS RedMask: bits being set to 1 over the indicated Green Field, and Green Bitmaps bits set over the Red Field in the diagram. (passel) Passela (talk) 18:03, 23 September 2012 (UTC)

Do you mean File talk:BitfieldsSLN.png? It was not a good idea, because the image actually belongs to Wikimedia Commons. Incnis Mrsi (talk) 18:36, 23 September 2012 (UTC)
So what's your point? Are you stating that the order of the fields must be constant? Verpies (talk)
I fixed these swapped bitfields so that they match the colors shown below and with the RGBAX notation, Passela was correct in their comment, you did not understand it... verdy_p (talk) 07:49, 25 November 2013 (UTC)

I don't like this image, because the colour format it implies isn't (commonly) used in practice. This makes the image a bit misleading. — Preceding unsigned comment added by (talk) 13:17, 18 January 2017 (UTC)

I think I figured out the BITMAPV2INFOHEADER and BITMAPV3INFOHEADER[edit]

These actually just refer to specific variants of the normal BITMAPINFOHEADER, where the Compression field in the header is set to BI_BITFIELDS. When the BI_BITFIELDS is specified, officially you are allowed to designate the positions of the bits for the RGB values. The remaining bits are unused. Because this required 3 additional 4byte-integer fields in the header (the 3 bit masks), the header is now 12 bytes longer than normal BITMAPINFOHEADER, and therefore requires the header size field in the header to be set at 52, rather than the normal 40. Therefore BITMAPV2INFOHEADER is actually within the official Microsoft specification for BITMAPINFOHEADER, and is not a new or undocumented form of header.

BITMAPV3INFOHEADER is the same as BITMAPV2INFOHEADER in that the compression field in the header is set for BI_BITFIELDS. The difference is that BITMAPV3INFOHEADER has its header size field set to 56 to accommodate one extra bit mask. This 4th bit mask is for alpha channel (often used as transparency/opacity data in image processing software like Photoshop). Keep in mind that this is NOT officially allowed according to Microsoft documentation for the BITMAPINFOHEADER which specifies that in BITMAPINFOHEADER which has its Compression field set to BI_BITFIELDS, only the 3 color channels (and not an alpha chennel) are to be specified. So unlike BITMAPV2INFOHEADER which is actually part of the BITMAPINFOHEADER specification, BITMAPV3INFOHEADER is an entirely separate and undocumented bitmap header. However it is a logical extension of the previous version of bitmap header.

The first version of bitmap header to be publicly documented and support an alpha channel is the BITMAPV4HEADER. However it also has a lot of extra fields for gamma, color space, and XYZ absolute color values for image calibration. As such, it has a lot of extra info that is only needed for high-end image processing. This seems to be a bit overkill for just getting an alpha channel stored in your BMP file, which is why Microsoft probably released the BITMAPV3INFOHEADER. Of course because Microsoft loves trade secrets, they kept the easy to use, yet quite powerful (due to alpha channel support), BITMAPV3INFOHEADER a proprietary specification. Adobe (which uses it) probably had to pay lots of money to get a copy of it from Microsoft. Fortunately an Adobe employee posted it on their forums in response to someone writing a complaint that Adobe was using unofficial bitmap header specs in their BMP files. I just wonder whether or not it was legal for them to post that in their forum, or if this leak constitutes some violation of non-disclosure agreement between Adobe and Microsoft. So yes, it appears to be an official spec from Microsoft, just not a publicly documented one.

As a result, BITMAPV3INFOHEADER may not be properly loaded by 3rd party software, that is neither from Microsoft nor Adobe, that is capable of loading BMP images. So if you create software that can write BITMAPV3INFOHEADER BMP files, don't be surprised if standard image viewers like ACDSee, XnView, or IrfanView have problems correctly displaying them.

A better way to create an alpha channel in a BMP file is to use BITMAPV4HEADER, and just make sure that the field for the color space is to the constant sRGB (which has a numerical value of 0x73524742 or 0x00000000 depending on where you read the info) so that it will ignore the remaining color calibration information (the XYZ endpoints and RGB gamma). Because BITMAPV4HEADER is publicly documented, it is more likely that 3rd party image viewers will properly display it, although since the plain BITMAPINFOHEADER is most common bitmap header, there are probably many software packages out there that won't recognize a a BMP file with a BITMAPV4HEADER (but the main image viewers like ACDSee, XnView, and IrfanView will probably work with BITMAPV4HEADER, and might even work with the not-publicly-documented BITMAPV3INFOHEADER if the developers had previously reverse engineered it, had looked at the Adobe forum post I mentioned here, or had independently written it as a logical extension of the BITMAPINFOHEADER).

And this brings up an entirely new problem. There is a significant discrepancy between the Microsoft docs and other docs I've found. Microsoft defines these constants for the color space field for BITMAPV4HEADER: LCS_CALIBRATED_RGB = 0x00000000 LCS_sRGB = 0x73524742 LCS_WINDOWS_COLOR_SPACE = 0x57696E20

and gives these descriptions: LCS_CALIBRATED_RGB: Color values are calibrated red green blue (RGB) values. LCS_sRGB: The value is an encoding of the ASCII characters "sRGB", and it indicates that the color values are sRGB values. LCS_WINDOWS_COLOR_SPACE: The value is an encoding of the ASCII characters "Win ", including the trailing space, and it indicates that the color values are Windows default color space values.

Meanwhile defines the constants like this: LCS_CALIBRATED_RGB = 0 LCS_DEVICE_RGB = 1 LCS_DEVICE_CMYK = 2

And it gives these descriptions: LCS_CALIBRATED_RGB: The DIB uses the normalized sRGB colour space defined by ICM. LCS_DEVICE_RGB: The DIB uses the device dependent RGB colour space defined by a display device. This is the definition used by the older BITMAPINFOHEADER. LCS_DEVICE_CMYK: The DIB uses the device dependent CMYK colour space defined by a printer.

Notice that in Microsoft's definition, there is a clear difference between calibrated and sRGB color spaces, but in this other documentation the two seem to be the same. From this other source there is no mention of LCS_sRGB or LCS_WINDOWS_COLOR_SPACE constants, but there are two constants that the Microsoft documentation does not have, LCS_DEVICE_RGB and LCS_DEVICE_CMYK.

The LCS_CALIBRATED_RGB is the only constant who's numerical value is the same in both documents, but the second document seems to treat this as sRGB, whereas Microsoft has sRGB being a completely separate constant.

This document seems to have a more complete list of all possible values for the color space field than any other single document I've found from Microsoft or anywhere else

And just to be sure everything worked right, I'd probably go with the Microsoft specs on color space constants, because the BMP format and its constants are creations of Microsoft.


As for Adobe, they do have a slightly incorrect BMP image file. Specifically, Adobe appends two extra 0x00 bytes to the end of the file. For example a 640x480 32bpp image should have 1,228,800 bytes, but Photoshop's output for this same image has 1,228,802 bytes.

Benhut1 (talk) 22:42, 29 June 2014 (UTC)


Should this article not be titled “BMP (file format)”? PapíDimmi (talk | contribs) 20:00, 1 May 2017 (UTC)