A switching adaptive predictor (SWAP) with automatic fuzzy context modelling is proposed for lossless image coding. Depending on the context of the coding pixel, the SWAP encoder switches between two predictors: the adaptive neural predictor (ANP) and the texture context matching (TCM) predictor. The ANP is known to perform well and gives small prediction errors except for pixels around edges. For areas with edges, TCM is used. To decide which is to be used, a switching criterion is proposed to pick out pixels around edges effectively. With the switching predictor structure, small prediction errors can be achieved in both slowly varying areas and edges. Furthermore, the use of the so-called fuzzy context clustering for prediction error refinement is proposed. The proposed compensation mechanism is proved to be very useful through experiments. It further improves the bit rates by, on average, 0.2 bpp in test images. The experiments also show that an average improvement of 0.3 and 0.05 bpp in first-order entropy can be achieved when the proposed switching predictor is compared with the gradient adjusted predictor and a six-order edge directed predictor, respectively. Moreover, the lossless image coder built upon the proposed algorithm also provides lower bit rates than the state-of-the-art context-based, adaptive, lossless image coding (CALIC) system and is comparable to that obtained by the highly complex two-pass coder called TMW.