BMP File Size Limit due to HeaderSteve DiBartolomeo When Microsoft created the BMP format more than 20 years ago, I am sure the developers never thought people would use it for purposes that required file sizes of several GBytes. Implicit assumptions were made about the maximum file size which now prevents BMP from containing a bitmap larger than 4 GBytes. That's because the BMP header uses only 4 bytes to define the file size. At that time operating systems were 32 bits and could not address more than 4GB of data. Gerber to BMPArtwork's rasterizers are often used in applications where bitmaps larger than 4 GB are required. Since our RIPs are 64 bits, they can certainly generate very large bitmaps when converting Gerber (GDSII or ODB++) to BMP. However the user should understand that the output file can't exceed 4GB. Let's look at a typical high resolution example. Example 1 gbr2tiff.exe L01B1N.274x -274x -units:mm -bmp:test.bmp -dpi:12700 -wplot -50,-200 550,400 This is a window plot of 600 x 600 mm at a resolution of 2um pixel size. The uncompressed raster image size: (600,000 um)2 File Size (bytes) = ----------------------------------- = 11.25 GB (2 um/pixel)2 * 8 pixels/byte Monochrome BMP has no compressed format; this will be the size of the BMP output file. Since the file header cannot accommodate a value > 4 GB the reading program will not likely be able to handle such a file. Example 2 One way to work around this problem is to compress the data. Most bitmaps that originate from PCB or semiconductor mask data will compress 5X to 20X depending on the nature of the input data. Since our limitation is not on actual number of pixels in the file but rather what the file header says is the file "size" we can often produce raw bitmaps that are much greater than 4 GB. gbr2tiff.exe L01B1N.274x -274x -units:mm -pack:test.tif -dpi:12700 -wplot -50,-200 550,400 The exact same bitmap is losslessly compressed by gbr2tiff (using packbits) and ends up producing a TIFF file of only 400 MB. Unfortunately one has to use TIFF and not BMP because the BMP specification does not include this compression for monochrome images. BMP File Header
|