Reef-bank reservoirs are an important target for petroleum exploration in marine carbonates and also an essential supplemental area for oil and gas production in China. Due to the diversity of reservoirs and the extreme heterogeneity of reef-banks, it is very difficult to discriminate the sedimentary facies and lithologies in reef-bank reservoirs using conventional well logs. The borehole image log provides clear identification of sedimentary structures and textures and is an ideal tool for discriminating sedimentary facies and lithologies. After examining a large number of borehole images and cores, we propose nine typical patterns for borehole image interpretation and a method that uses these patterns to discriminate sedimentary facies and lithologies in reeI^bank reservoirs automatically. We also develop software with user-friendly interface. The results of applications in reef-bank reservoirs in the middle Tarim Basin and northeast Sichuan have proved that the proposed method and the corresponding software are quite effective.