MathGroup Archive 1997

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

Search the Archive

Re: importing images

  • To: mathgroup at
  • Subject: [mg8559] Re: [mg8503] importing images
  • From: Fabian Haas <b5hafa at>
  • Date: Sat, 6 Sep 1997 23:16:23 -0400
  • Sender: owner-wri-mathgroup at

>Greetings everyone,
>	I am trying to utilize Mma 3.0 in my Image Processing course and have
>run into a bit of a snag. It seems that it can DISPLAY many forms of
>graphics, but I wish to be able to, say, import a 8-bit grayscale *.gif
>file into mma as a matrix of grayscale values. The same would apply to
>jpeg, tiff, and bmp files as well. Has anyone done this or is there a
>kind soul who could shed some light on this subject for me? Thanks in
>Al Arduengo
>exal at

Hi Al,
there are ways to do that: convert the images to RAW data and then you can=
 read them in using following function:

ReadPic8[filename_String, rows_Integer, cols_Integer] := Module[{goodbytec=
ount = rows*cols, pic, actual, fp}, actual = FileByteCount[filename];
If[actual != goodbytecount, Print["File not of correct size or missing."];
fp = OpenReadBinary[filename, FilenameConversion->Identity]; pic ==
 ReadListBinary[fp, Int8];
pic = N[Partition[pic,cols]];

The function has been written by Mark Evans by the way. I modified it a=
 little to


Clear[ ReadPic8]

ReadPic8[filename_String, rows_Integer, cols_Integer] :=
Module[{goodbytecount = rows*cols},

actual = FileByteCount[filename];

fp = OpenReadBinary[filename];

pic = ReadListBinary[fp, Int8];
pic = N[Partition[pic,cols]];

The other way seems to be the MovieDigitizer distributed through MathSource.=
 This small programme is capable of importing picture/pixels from QuickTime=
 movies and runs on Macs.

Hope it helps


Dipl.Biol. Fabian Haas, MPhil
Institut f=FCr Spezielle Zoologie und Evolutionsbiologie
Erbertstr. 1
D-07743 Jena
b5hafa at
Deutschland / Germany
TEL  ++ 49 3641 630 424
=46AX  ++ 49 3641 630 392
                               :-)  (-:

  • Prev by Date: Re: lists of pairs
  • Next by Date: RE: Q: Union and precision.
  • Previous by thread: Re: importing images
  • Next by thread: Re: REQ: Algorythm for combinations