In this paper, a parameterized four direction contour-invariant extrapolator for differential pulse code modulation (DPCM) image compression is presented. Two calculation methods for extrapolation are available - linear and nonlinear one. Chosen method for extrapolation depends on the presence of a contour inside the vicinity of every processed pixel. Parameter responsible for the choice of calculation method is optimized before compression during recursive image size independent learning procedure. Computational experiments are carried out on a test set of images in order to examine proposed extrapolator. The advantage in terms of RMS error of proposed extrapolator over other ones on a certain types of images is shown.