PImage pict; //variable that holds image data void setup(){ size(480,640); background(0); pict = loadImage("a3.png"); //load the image into the sketch //imageMode(CENTER); smooth(); } void draw() { imageMode(CORNER); image(pict, 0, 0, width,height); PImage crop = pict.get(mouseX, 0, mouseX, height);//using mouseX as the size parameter causes the resizing of the box imageMode(CENTER); image(crop, mouseX, height/2); }