returns a rasterized version of the displayed form of expr.


gives the element elem associated with the rasterized form of expr.


gives a list of the specified elemi.

Details and Options

  • The expression expr can be graphics, text, a cell, a notebook object or any other expression.
  • Rasterize[nb] gives a rasterized version of the complete content associated with the notebook object nb.
  • Possible basic elements that can be returned by Rasterize include:
  • "BoundingBox"bounding box information for the raster
    "Data"the array of pixel values in the raster
    "Graphics"a graphics object representing the raster
    "Image"an image object representing the raster
    "RasterSize"pixel width and height of the raster
    "Regions"regions specified by Annotation constructs
  • Rasterize[expr] is equivalent to Rasterize[expr,"Image"] and displays in a notebook in a way that approximates the unrasterized display of expr, with the same image size.
  • The following options for Rasterize can be given:
  • BackgroundAutomaticbackground to use
    BaselinePositionAutomatichow to align with a surrounding text baseline
    ImageFormattingWidth$ImageFormattingWidthwrapping width for expressions to be rasterized
    ImageResolutionAutomaticimage resolution in dpi for rasterization
    ImageSizeAutomaticfinal displayed image size in printer's points
    RasterSizeAutomaticraster size in pixels for rasterization
  • RasterSize and ImageResolution determine the coarseness of rasterization; ImageSize determines the size at which the final image will be displayed.
  • If there is an explicit setting for RasterSize, it overrides any explicit setting for ImageResolution.
  • When the settings for RasterSize or ImageResolution are small, the graphic will appear coarse, and text may be illegible. There may also be artifacts associated with aliasing.
  • Settings for ImageSize and Background in Rasterize override any settings for those options in expr.
  • Background->None yields a raster with a transparent background.
  • If no explicit size or resolution option settings are given, Rasterize[expr,] will rasterize expr at the size and resolution it would normally be displayed in a notebook.
  • Rasterize[expr,"RasterSize"] yields {w,h}, where w is the overall width in pixels of the raster, and h is its overall height.
  • Rasterize[expr,"BoundingBox"] yields {w,h,dh}, where w is the overall width, h is the overall height, and dh is the offset of the baseline of the contents of expr from the bottom of its bounding box.
  • Images generated by Rasterize can vary slightly from one computer system to another, mainly as a result of different fonts and anti-aliasing procedures.
  • The results from Rasterize[expr,"BoundingBox"] can depend on details of font metrics, which generally differ between different computer systems.
  • Rasterize[expr,"Regions"] gives a list of rules of the form {{a1,type1}->reg1,{a2,type2}->reg2,}, where each rule {ai,typei}->regi is associated with an annotation of the form Annotation[expr,ai,typei] in expr, or with an object that is automatically recognized as an annotation, such as a Hyperlink or Tooltip. The regi give pixel positions in the form {{xmin,ymin},{xmax,ymax}}, where y coordinates run from top to bottom, mirroring the coords attribute of HTML.


open all close all

Basic Examples  (3)

Make a 15-pixel-wide rasterization of an image of a disk:

Click for copyable input

Make a 75-pixel-wide rasterization of text, and display it 200 pixels wide:

Click for copyable input

Make a 36 dpi rasterization of a 3D graphic with light yellow background:

Click for copyable input

Scope  (11)

Options  (6)

Applications  (3)

Properties & Relations  (2)

Neat Examples  (1)

Introduced in 2007
Updated in 2017