Biogeography has a fundamental role in gut–microbiota interactions; however, methods for imaging this biogeography have been lacking. Earle et al. took advantage of improved mucus fixation protocols to develop a pipeline for large-scale quantitative spatial imaging of gut microbiota. They developed a new computational tool, BacSpace, that stitches together a single continuous image from raw data and measures the distance coordinates of luminal fluorescence signals — separated into bacteria and host factors — to and along the epithelium. To demonstrate the utility of the pipeline, the authors eliminated microbial-accessible carbohydrates from the diet of mice colonized with microbiota from a human donor, which deprived the microbiota of its primary metabolic input. This revealed a thinner mucus layer that is in closer proximity to bacterial cells, a more homogeneous community organization, and upregulation of the inflammatory marker REG3β.