Throwing NullPointerException in Image.replacePixels.