Image Display

Display images using an interactive JavaScript viewer or R's built-in graphics capabilities.

display(x, title = deparse(substitute(x), width.cutoff = 500L, nlines = 1), method, frame, all = FALSE, ...)
an Image object or an array.
a character string used as a window title.
the method used to display images, can be browser or raster. Defaults to browser when R is used interactively and raster otherwise. The default behavior can be overridden by setting options("EBImage.display"). See Details.
a numeric indicating the frame number; only works in conjunction with method = "raster" and all = FALSE.
should all frames of a stacked image be displayed, or just a single frame?
arguments passed to internal methods

The default method used for displaying images depends on whether called from and interactive R session. If interactive() returns TRUE images are displayed using the "browser" method, otherwise the "raster" method is used. This behavior can be overridden and the default display method fixed regardless the interactivity by setting options("EBImage.display") to either "browser" or "raster".

The "browser" method runs an interactive JavaScript image viewer using the default web browser. Multiple windows or tabs can be opened in this way. Pressing 'h' displays a list of available features along with corresponding mouse and keyboard actions.

The "raster" method displays images as raster graphics using R's build-in functions. By default only the first frame of a stacked image is shown; a different frame can be specified using the frame argument. When all=TRUE all frames are rendered and automatically positioned next to each other in a grid. The user coordinates of the plotting region are set to the image pixel coordinates with the origin (0, 0) in the upper left corner.


Invisible NULL.


For the "browser" method a compatible web browser with JavaScript enabled is required (e.g. Mozilla Firefox).


Mozilla Firefox

  • display
  ## Display a single image
  x = readImage(system.file("images", "sample-color.png", package="EBImage"))[257:768,,]
  display(x, "Sample")

  ## Display a thresholded sequence ...
  y = readImage(system.file("images", "sample.png", package="EBImage"))
  yt = list()
  for (t in seq(0.1, 5, len=9)) yt=c(yt, list(gblur(y, s=t)))
  yt = combine(yt)

  ## ... using the browser viewer ...
  display(yt, "Blurred images")

  ## ... or using R's build-in raster functions
  display(resize(yt, 256, 256), method = "raster", all = TRUE)

  ## Display the last frame 
  display(yt, method = "raster", frame = numberOfFrames(yt, type = "render"))
Documentation reproduced from package EBImage, version 4.14.2, License: LGPL

Community examples

Looks like there are no examples yet.