Don't call InvertPixelArray with negative width and/or height.