The gradient adjusted predictor (GAP) uses seven fixed slope quantization bins and a predictor is associated with each bin, for prediction of pixels. The slope bin boundary in the same appears to be fixed without employing a criterion function. This paper presents a technique for slope classification that results in slope bins which are optimum for a given set of images. It also presents two techniques that find predictors which are statistically optimal for each of the slope bins. Slope classification and the predictors associated with the slope bins are obtained off-line. To find a representative predictor for a bin, a set of least-squares (LS) based predictors are obtained for all the pixels belonging to that bin. A predictor, from the set of predictors, that results in the minimum prediction error energy is chosen to represent the bin. Alternatively, the predictor is chosen, from the same set, based on minimum entropy as the criterion. Simulation results, of the proposed method have shown a significant improvement in the compression performance as compared to the GAP. Computational complexity of the proposed method , excluding the training process, is of the same order as that of GAP.Keywords GAP · MED · Gradient · LS-based predictor ·