This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)

BMP (.bmp, .dib, .rle)

MIME type: image/bmp
BMP Windows bitmap format.
Raster image format.
Native bitmap format of the Microsoft Windows operating system.
BMP is an acronym derived from Bitmap.
Binary file format.
Stores color bitmaps at a variety of color resolutions.
Allows different bit depths in different channels.
Has support for color reduction palettes using up to 256 8-bit RGB colors.
Supports transparency.
Stores data in uncompressed or run-length encoded form.
  • Export exports graphics or any other expression as an image to BMP.
  • When exporting Mathematica graphics or arbitrary expressions to BMP, the resulting image has the same raster size as its displayed form.
  • Image objects are by default exported at their raster size.
  • Because BMP is a raster image format, all fonts are rasterized on export.
  • Import imports the specified element from a BMP file.
  • Import imports multiple elements.
  • Export creates a BMP file by treating expr as specifying element elem.
  • Export treats each as specifying the corresponding .
  • Export exports expr with the specified option elements taken to have the specified values.
  • Export uses rules to specify the elements to be exported.
  • See the reference pages for full general information on Import and Export.
  • In the notebook front end, InsertPicture and the Open menu allow import of a BMP file into a cell.
"Elements" list of elements and options available in this file
"Rules"full list of rules for each element and option
"Options"list of rules for options, properties, and settings
  • Data representation elements:
"Data"array of color values based on the encoding given by
"Graphics"Graphics object representing an image
"Image"raster image, given as an Image object
"GrayLevels"array of normalized gray-level values
"RawData"color indices, given as an integer array
"RGBColorArray"array of RGBColor objects
  • Import and Export by default use the element for Windows bitmap files.
  • Export automatically selects the most appropriate type of BMP file to store binary, grayscale, and color images.
  • Export creates a BMP file with indexed color when exporting color-mapped raster graphics or if the element is specified.
"BitDepth"number of bits used to encode a color channel in the file
"ColorDepth"number of bits for each pixel
"ColorMap"color reduction palette used in the file
"ColorSpace"color encoding
"ImageCompression"compression method used in the file
"ImageResolution"resolution at which the graphics should be rendered
  • The BMP format supports the following values for :
1palette of 2 colors
4color reduction palette of size 16
8color reduction palette of size 256
16typically 5 bits per color channel
24RGB using 8 bits per channel
32typically 8-bit RGB with opacity
  • General option:
ImageSizeAutomaticoverall image size
"ImageTopOrientation"Toporientation of the image as stored in the file
"ImageCompression"Nonewhether to use run-length encoding
  • Possible settings for "" are None and "".
Import a BMP file:
Export raster graphics to BMP:
All available Import elements:
Image resolution information stored in the file:
Export rasterized vector graphics to BMP:
Exporting this graphics expression creates a BMP file with a color reduction palette:
Export a binary image to BMP:
Import a BMP file:
In[1]:=
Click for copyable input
Out[1]=
 
Export raster graphics to BMP:
In[1]:=
Click for copyable input
Out[1]=
 
All available Import elements:
In[1]:=
Click for copyable input
Out[1]=
 
Image resolution information stored in the file:
In[1]:=
Click for copyable input
Out[1]=
 
Export rasterized vector graphics to BMP:
In[1]:=
Click for copyable input
Out[1]=
 
Exporting this graphics expression creates a BMP file with a color reduction palette:
In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=
 
Export a binary image to BMP:
In[1]:=
Click for copyable input
Out[1]=