/* @pjs preload="ref_string.jpg,lake.jpg"; */ size(472,266); PImage img = loadImage("lake.jpg"); PImage img2 = loadImage("ref_string.jpg"); image(img, 0, 0); copy(30, 220, 30, 30, 235, 25, 60, 60); copy(160, 130, 60, 60, 200, 200, 60, 60); noFill(); // Rectangle shows area being copied rect(30, 220, 30, 30); rect(160, 130, 60, 60); // copy a 50x50 piece of ref_string to 50,50 on canvas copy(img2,25,25,50,50,50,50,50,50); // get piece of ref_string and place at 100,100 PImage result = img2.get(0,0,50,80); image(result,100,100); image(img2,372,0);