MathGroup Archive 1999

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

Search the Archive

Re: Importing graphics into mathematica

  • To: mathgroup at
  • Subject: [mg19260] Re: Importing graphics into mathematica
  • From: paulh at (P.J. Hinton)
  • Date: Thu, 12 Aug 1999 01:24:18 -0400
  • Organization: "Wolfram Research, Inc."
  • References: <7or4qd$>
  • Sender: owner-wri-mathgroup at

In article <7or4qd$13q at>, "Getz" <chonat at> writes:

>I am having a problem importing graphics into mathematica in a form 
>which can be manipulated by the kernel.
>There is NO problem in opening  any graphic image via OPEN in FILE menu 
>or copying and pasting.
>After opening the graphic in mathematica, I select it and then use the 
>command CELL>CONVERT TO>INPUTFORM. This gives a listing of the graphic 
>object (apparently different kindsof lists for different objects) but 
>the image fails to materialise. Sometimes I get an empty space and at 
>other times I get a failed message.
>The graphics programs that I use are paint, power point, ipplus and 
>micrografx picture publisher.

It sounds as if you are trying to import a bitmap graphic.  Is
that correct?

In Mathematica 4, the Import[] function can be used to read
several different common bitmap formats.  Consult the online
refrence guide for details


In Mathematica 3.0 and earlier versions, your best bet is to 
convert the graphic into a lowest common denominator format 
and read it in.  The formats which apply here are:

	format			suitable for
	portable bitmap		bilevel images
	portable graymap	grayscale images
	portable pixmap		color images

The specifications for these formats can be downloaded from
Wotsit's Format?

The formats you want are PBM, PGM, and PPM.

You may have an image converter program that can translate your
existing graphic file into one of these formats. 

Once you have converted your image to this format, it is just a
matter of reading the converted file using ReadList[], converting
the numerical values into an appropriate color directive (RGBColor[]
or GrayLevel[]) and throwing it into a RasterArray[].

P.J. Hinton
Mathematica Programming Group           paulh at
Wolfram Research, Inc.
Disclaimer: Opinions expressed herein are those of the author alone.

  • Prev by Date: Re: Linux sound output
  • Next by Date: Re: Cleanslate -- where to find it?
  • Previous by thread: Importing graphics into mathematica
  • Next by thread: Importing graphics into mathematica-Addition