drawtext {EBImage}R Documentation

Draw text on images.

Description

Draws text on images.

Usage

  drawtext(img, xy, labels, font, col)
    
  drawfont(family=switch(.Platform$OS.type, windows="Arial", "helvetica"), 
           style="n", size=14, weight=200, antialias=TRUE)

Arguments

img

An Image object or an array.

xy

Matrix (or a list of matrices if img contains multiple frames) of coordinates of labels.

labels

A character vector (or a list of vectors if img contains multiple frames) containing the labels to be output.

font

A font object, returned by drawfont. If missing, a default OS-dependent font will be chosen.

col

A character vector of font colors.

family

A character value indicating the font family to use. Valid examples on Linux/UNIX systems include helvetica, times, courier and symbol. Valid examples on Windows machines include TrueType like Arial and Verdana.

style

A character value specifying the font style to use. Supported styles are: normal (default), italic, and oblique.

size

Font size in points.

weight

A numeric value indicating the font weight (bold font). Supported values range between 100 and 900.

antialias

A logical value indicating whether the font should be anti-aliased.

Value

An Image object or an array, containing the transformed version of img.

Author(s)

Oleg Sklyar, osklyar@ebi.ac.uk, 2007

Examples

  lena = readImage(system.file("images", "lena-color.png", package="EBImage"))
  font = drawfont(weight=600, size=28)
  lena = drawtext(lena, xy=c(250, 450), labels="Lena", font=font, col="white")
  if (interactive()) display(lena)

[Package EBImage version 3.10.0 Index]