$ 0 0 The problem is most likely a mistake in the x,y width,height arguments. I think you are cropping the image to an area larger than the image is.