Context-based modeling is an important step in high-performance lossless data compression. To effectively define and utilize contexts for natural images is, however, a difficult problem. This is primarily due to the huge number of contexts available in natural images, which typically results in higher modeling costs, leading to reduced compression efficiency. Motivated by the prediction by partial matching context model that has been very successful in text compression, we present prediction by partial approximate matching (PPAM), a method for compression and context modeling for images. Unlike the PPM modeling method that uses exact contexts, PPAM introduces the notion of approximate contexts. Thus, PPAM models the probability of the encoding symbol based on its previous contexts, whereby context occurrences are considered in an approximate manner. The proposed method has competitive compression performance when compared with other popular lossless image compression algorithms. It shows a particularly superior performance when compressing images that have common features, such as biomedical images.