MGF (.mgf)


    Wolfram System MGF bitmap format.
    Used by the Wolfram System 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 Wolfram Language 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.


  • 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.


ExamplesExamplesopen allclose all

Basic Examples  (2)Basic Examples  (2)

Import an MGF file as graphics:

Click for copyable input

Export arbitrary graphics to the MGF format:

Click for copyable input
Introduced in 1999
| Updated in 2007
Translate this page: