# NodeBox

Create visual output with Python programming code
Home Download Reference Tutorial Library Gallery About

# photobot.Canvas.fill()

## Syntax

    canvas.fill(rgb, x=0, y=0, w=None, h=None, name="")

## Description

Creates a new layer filled with the given rgb color. The rgb parameter is a tuple with three values (red, green, blue) ranging between 0 and 255. For example, fill((255,0,0)) creates a red fill. The layer fills the entire canvas by default, or you can set its position and size with the x, y, w (width) and h (height) parameters. You can supply a name for the fill layer.

## Example

This puts the robot.jpg image at 95% opacity on an orange background .

    photobot = ximport("photobot")
    canvas = photobot.canvas(200,200)
    canvas.fill((255,128,0))
    canvas.layer("images/robot.jpg")
    canvas.layers[2].opacity(95)