MGF (.mgf)

Wolfram Mathematica MGF bitmap format.
Used by the Mathematica user interface for storing raster images.
MGF is an acronym for Mathematica Graphics Format.
Binary format.
Stores a single image as an RGB raster at a resolution of 8 bits per color channel.

Import and ExportImport and Export

  • Import["file.mgf"] imports an MGF file and returns an image.
  • Export["file.mgf", expr] exports an image, graphics, or any other expression as an MGF raster image.
  • When exporting Mathematica graphics or arbitrary expressions to MGF, the resulting image has the same raster size as its displayed form.
  • Image objects are by default exported at their raster size.
  • Because MGF is a raster image format, all fonts are rasterized on export.
  • Import["file.mgf", elem] imports the specified element from an MGF file.
  • Import["file.mgf", {elem, suba, subb, ...}] imports a subelement.
  • Import["file.mgf", {{elem1, elem2, ...}}] imports multiple elements.
  • The import format can be specified with Import["file", "MGF"] or Import["file", {"MGF", elem, ...}].
  • Export["file.mgf", expr, elem] creates an MGF file by treating expr as specifying element elem.
  • Export["file.mgf", {expr1, expr2, ...}, {{elem1, elem2, ...}}] treats each as specifying the corresponding .
  • Export["file.mgf", expr, opt1->val1, ...] exports expr with the specified option elements taken to have the specified values.
  • Export["file.mgf", {elem1->expr1, elem2->expr2, ...}, "Rules"] uses rules to specify the elements to be exported.
  • See the reference pages for full general information on Import and Export.
  • ImportString and ExportString support the MGF format.

ElementsElements

  • General Import elements:
  • "Elements" list of elements and options available in this file
    "Rules"full list of rules for each element and option
    "Options"list of rules for options, properties, and settings
  • Data representation elements:
  • "Cell"notebook Cell expression representing the image
    "Graphics"raster image given as a Graphics object
    "Image"image object
  • Import and Export by default use the element for MGF files.

OptionsOptions

ExamplesExamplesopen allclose all

Basic Examples (2)Basic Examples (2)

Import an MGF file as graphics:

In[1]:=
Click for copyable input
Out[1]=

Export arbitrary graphics to the MGF format:

In[1]:=
Click for copyable input
Out[1]=
New in 4 | Last modified in 6
New to Mathematica? Find your learning path »
Have a question? Ask support »