Bitmap vs. Vector Formats

Choosing a Format

There are two kinds of graphics file formats that you can create from MATLAB® figures:

  • Bitmaps images — Screen pixels captured in a file.

  • Vector graphics — Commands to drawn individual objects.

The kind of file you use depends on how you want to present the exported graphics and if you want to modify the graphics in an external program.

Bitmap Format

  • Widely used by Web browsers and other applications that display graphics.

  • Resolution and output dimensions determine size

  • Scaling can reduce quality

  • Cannot modify individual graphics objects (such as lines and text) from other graphics applications

Vector Format

  • Graphics applications can modify graphics object characteristics (such as color, line style, and text font)

  • Scalable size

  • Slower to render and can result in larger files

  • Might not produce correct 3-D arrangement of objects in certain cases

For a list of supported formats, see Graphics File Formats in the print command page.

How Renderer Affects Format

The renderer is the part of MATLAB that determines how to display graphics on the screen, send graphics to a printer, or write graphics to a file. MATLAB uses two rendering methods:

  • Painter's — Used for vector format output (PDF, SVG, PostScript®, EPS, metafile) and whenever you specify Painter's as the screen renderer by setting the figure Renderer property.

  • OpenGL® — Produces a bitmap even with vector formats. OpenGL is the default screen renderer and is used for printing except when you specify a vector format.

MATLAB attempts to use the Painter's renderer for exporting to vector formats if the figure RendererMode property is set to auto However, MATLAB does not use the Painter's renderer in cases in which you:

  • Explicitly specify OpenGL as the screen renderer, which sets the figure RendererMode property to manual.

  • Override the figure Renderer property from the Export Setup dialog.

  • Specify a renderer with the print command.

Controlling Graphics Output

In most cases, MATLAB uses the appropriate renderer to produce the output format that you request.

However, if a figure contains a very large number of graphics objects that need to be arranged by 3-D depth, MATLAB might use OpenGL and create a bitmap in the output format. In these cases, a vector format like EPS or PDF actually contains a bitmap, which might limit the extend to which you can edit the image in other applications.

If you want to ensure that your output format is a true vector graphic file, then specify the renderer with the Export Setup dialog or the print command.

For example, this command always generates a vector format:

print -deps -painters myVectorFile

In some cases, exporting a file with the -painters option can cause longer rendering times and, in rare cases, might produce graphics that are not accurate with regard to 3-D arrangement of the graphics objects.

Was this topic helpful?