Services & Resources / Wolfram Forums / MathGroup Archive

MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

bitmap with bit depth 1

  • To: mathgroup at
  • Subject: [mg104399] bitmap with bit depth 1
  • From: "van der Burgt, Maarten" <Maarten.VanDerBurgt at>
  • Date: Fri, 30 Oct 2009 02:19:35 -0500 (EST)


Using Mathematica 7.0.1 for Windows, I want to create binary bitmap 
(Windows BMP format) images with a bit depth of 1 (generally grey scale 
or color bitmap images have a bit depth of 8 or 24)

Here is my data:

dat =RandomInteger[{0,1},{200,200}]

The image generated from it looks ok:

im = Image[dat,"Bit"]

The right mouse click on the image and selecting Image Mode indeed tells 
me the image is binary with a bit depth of 1 bit/Channel. As does:

{ImageChannels[im], BinaryImageQ[im],ImageType[im]}


But all the images exported:


Export["test2.bmp",im, "ColorDepth"=AE1];

Export["test3.bmp",im, "BitDepth"=AE1];

Export["test4.bmp",im, "BitDepth"=AE1,"ColorDepth"=AE1];

are 8 bit greyscale images.

Saving the image via the right mouse click on the image and choosing 
=93Save Image As..=94 saves a 24 bit image.

I current solution is the use of another package to reduce the bit 
depth, but this is not satisfactory. 

Am I doing something wrong here or is Mathematica failing here?

On top of this, I cannot import these image back into mathematica:

Import["test4.bmp" ]

Import::fmterr: Cannot import data as \[NoBreak]BMP\[NoBreak] format. 
=87 =


Any help is appreciated.



  • Prev by Date: Re: problem of syntax.
  • Next by Date: Memory Management Issue - Possible Bug or Incompatibility w W7?
  • Previous by thread: Re: ToExpression[..,TexForm] does not seem to work on
  • Next by thread: Re: bitmap with bit depth 1