pyM²aia is a Python package for memory-efficient access and processing of mass spectrometry image data. The I/O functionality is derived from the interactive desktop application M²aia. Special features are the batch generator utilities for deep learning applications.