bitmap with bit depth 1
- To: mathgroup at smc.vnet.net
- Subject: [mg104399] bitmap with bit depth 1
- From: "van der Burgt, Maarten" <Maarten.VanDerBurgt at icos.be>
- Date: Fri, 30 Oct 2009 02:19:35 -0500 (EST)
Hallo,
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]}
{1,True,Bit}
But all the images exported:
Export["test1.bmp",im];
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 =
<http://reference.wolfram.com/mathematica/ref/message/Import/fmterr.html>
$Failed
Any help is appreciated.
regards
Maarten
- Follow-Ups:
- Re: bitmap with bit depth 1
- From: Patrick Scheibe <pscheibe@trm.uni-leipzig.de>
- Re: bitmap with bit depth 1