# NodeBox

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

# photobot.Layer.duplicate()

## Syntax

    canvas.layers[i].duplicate()

## Description

Creates a copy of layer i. This copy becomes the top layer on the canvas, and retains the same position, blend mode and opacity as the original layer.

The name of the duplicate is identical to the name of the original layer.

## Example

    photobot = ximport("photobot")
    canvas = photobot.canvas(100,100)
    canvas.layer("robot.jpg", name="robot")
    for i in range(2,50):
      canvas.layers[1].duplicate()
      canvas.layers[i].name += " " + str(i)
      print canvas.layers[i].name
      canvas.layers[i].translate(0,i)