added invert pixels switch