画像に四角形の枠線を描画します。
rectangle(x1, y1, x2, y2, color)
x1, y1: 左上の座標x2, y2: 右下の座標color: image.color(r,g,b,a=0) で割り当てた色img = GD::Image.new(400,300)
red = img.color(255,0,0)
img.rectangle(50,50,200,150,red)
img.save("rect.png")
このメソッドは libgd の gdImageRectangle に直接マッピングされています。