MathGroup Archive 2009

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

Search the Archive

Re: Re: bitmap with bit depth 1

  • To: mathgroup at smc.vnet.net
  • Subject: [mg104525] Re: [mg104441] Re: [mg104399] bitmap with bit depth 1
  • From: "van der Burgt, Maarten" <Maarten.VanDerBurgt at icos.be>
  • Date: Tue, 3 Nov 2009 02:53:23 -0500 (EST)
  • References: <200910300719.CAA27777@smc.vnet.net> <200910310655.BAA13399@smc.vnet.net>

Hallo,

Thanks for the lovely image.
It does seem to work with the portable bitmap format.

However, I do indeed need the Windows BMP format (the tools I will be
working with are simply configured that way). 
For the Windows BMP format, generating an image bit depth of 1
bit/Channel does not work in Mathematica.
So any suggestions are still welcome.

Has anyone seen an intermittent problem importing BMP files?
As:
Import["test4.bmp"]
Import::fmterr: Cannot import data as BMP format. >>

I have not been able yet to work out under what conditions this problem
shows up. Sometimes the problem is simply gone without (me seeing) any
reason.

- adding "BMP" in the import argument does not help
- having the file local (C:\\ or C:\Users\maarten\Documents) or on the
network does not make a difference.

regards and thanks for your help,

Maarten

-----Original Message-----
From: Patrick Scheibe [mailto:pscheibe at trm.uni-leipzig.de]
Sent: Saturday, 31 October, 2009 07:55
To: mathgroup at smc.vnet.net
Subject: [mg104525] [mg104441] Re: [mg104399] bitmap with bit depth 1

Hi,

has it to be a bmp? If not then

Image[Reverse@
  Table[If[(x^2 + y^2 - 1)^3 - x^2 y^3 > 0.0, 0, 1], {y, -2, 2,
    4/255.}, {x, -2, 2, 4/255.}], "Bit"]
Export["~/tmp/binimg.pbm", %]
{ImageType[#], ImageChannels[#], ImageDimensions[#]} &@Import[%]

should help.

Cheers
Patrick

On Fri, 2009-10-30 at 02:19 -0500, van der Burgt, Maarten wrote:
> 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
>
>
>




  • Prev by Date: Re: dynamicmodule with f[x_] possible?
  • Next by Date: Re: Using Mathematica 5.2 and 7.01 with separate settings
  • Previous by thread: Re: bitmap with bit depth 1
  • Next by thread: Factor and/or Rules replacements