ruby-libgd

GD::Image#text

Draws text on the image using a TrueType font.

Signature

text(string, x:, y:, size:, color:, font:)

Parameters

Example

img = GD::Image.new(400,200)
black = img.color(0,0,0)

img.text(
  "Hello Ruby",
  x: 20, y: 100,
  size: 24,
  color: black,
  font: "./fonts/DejaVuSans.ttf"
)

img.save("text.png")

Notes