MGF (.mgf)

  • Import and Export fully support the MGF format.
  • Background

      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 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 expri as specifying the corresponding elemi.
    • 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 "Image" element for MGF files.



    Basic Examples  (1)

    Export arbitrary graphics to the MGF format:

    Click for copyable input

    Import the new MGF file as graphics:

    Click for copyable input

    See Also

    "GIF"  "PNG"  "PNM"  "PPM"  "TIFF"

    Introduced in 1999
    | Updated in 2007