Machine learning methods are changing the way data is analyzed. One of the most powerful and widespread applications of these techniques is in image segmentation wherein disparate objects of a digital image are partitioned and classified. Here we present an image segmentation program incorporating a series of unsupervised clustering algorithms for the automatic thickness identification of two-dimensional materials from digital optical microscopy images. The program identifies mono- and few-layer flakes of a variety of materials on both opaque and transparent substrates with a pixel accuracy of roughly 95%. Contrasting with previous attempts, application generality is achieved through preservation and analysis of all three digital color channels and Gaussian mixture model fits to arbitrarily shaped data clusters. Our results provide a facile implementation of data clustering for the universal, automatic identification of two-dimensional materials exfoliated onto any substrate.