Gauss-Newton approximates the Hessian of a problem with a positive semi-definite matrix, constructed from the Jacobian. This means it can only model quadratics with a minimum. It drops other higher order terms, that might otherwise change the quadratic model to that with a maximum. If you want to maximize the sum of squares, then you need to include those terms, and hope that you then get a negative semi-definite matrix. However, there is no guarantee you will. In your particular case, you are maximizing costs over a discrete field (pixel values). Locally, the gradients may imply that the cost will continue increasing the further you move, even if the neighbouring samples do not reflect that - indeed they cannot reflect that, since they are bounded. This is problematic.