This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.

Rasterize

 Rasterize[g]returns a rasterized graphic of g. Rasterizegives the element elem associated with the rasterized form of g.
• The expression g need not explicitly be a graphic, but can be text, a cell, or any expression.
• Possible basic elements 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[g] is equivalent to Rasterize, and displays in a notebook in a way that approximates the unrasterized display of g, with the same image size.
• The following options for Rasterize can be given:
 Background Automatic background to use BaselinePosition Automatic how to align with a surrounding text baseline ImageResolution Automatic image resolution in dpi for rasterization ImageSize Automatic final displayed image size in printer's points RasterSize Automatic raster size in pixels for rasterization
• 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.
• If no explicit size or resolution option settings are given, Rasterize will rasterize g at the size and resolution it would normally be displayed in a notebook.
• Rasterize yields , where w is the overall width in pixels of the raster, and h is its overall height.
• Rasterize yields , where w is the overall width, h is the overall height, and dh is the offset of the baseline of the contents of g from the bottom of its bounding box.
• Rasters 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 can depend on details of font metrics, which generally differ between different computer systems.
• Rasterize gives a list of rules of the form , where each rule is associated with an annotation of the form Annotation in g. The give pixel positions in the form , where y coordinates run from bottom to top, as in Graphics.
Make a 15-pixel-wide rasterization of an image of a disk:
Make a 75-pixel-wide rasterization of text, and display it 200 pixels wide:
Make a 36 dpi rasterization of a 3D graphic, with light yellow background:
Make a 15-pixel-wide rasterization of an image of a disk:
 Out[1]=

Make a 75-pixel-wide rasterization of text, and display it 200 pixels wide:
 Out[1]=

Make a 36 dpi rasterization of a 3D graphic, with light yellow background:
 Out[1]=
 Scope   (10)
Convert any Mathematica expression into a raster graphic:
The default output is a raster graphic:
Get the bounding box information:
Get the array of pixel values for the raster:
Get the raster graphic:
Get the pixel dimensions of the raster:
Define regions using Annotation:
Get the defined regions:
Display the regions using rectangles:
Set background color:
Set image resolution:
Set raster size in pixels:
 Options   (4)
Set background color:
By default, the background is opaque white:
Make the background transparent, by setting Background->None:
Set different image resolution in dpi:
Set different raster sizes in pixels:
 Applications   (3)
Image of the first 1000 letters from the U.S. Constitution:
Thumbnail of a Mathematica notebook:
Rasterize a line segment with grid lines:
With antialiasing:
Without antialiasing:
Rasterizing a graphic with a custom ImageSize option works by changing the graphic's ImageSize, not by magnifying the graphic:
A graphic embedded in a non-graphical construct will magnify instead:
Pages from the U.S. Constitution: