Organic–inorganic perovskites such as CH3NH3PbI3 are promising materials for a variety of optoelectronic applications, with certified power conversion efficiencies in solar cells already exceeding 21%. Nevertheless, state-of-the-art films still contain performance-limiting non-radiative recombination sites and exhibit a range of complex dynamic phenomena under illumination that remain poorly understood. Here we use a unique combination of confocal photoluminescence (PL) microscopy and chemical imaging to correlate the local changes in photophysics with composition in CH3NH3PbI3 films under illumination. We demonstrate that the photo-induced ‘brightening’ of the perovskite PL can be attributed to an order-of-magnitude reduction in trap state density. By imaging the same regions with time-of-flight secondary-ion-mass spectrometry, we correlate this photobrightening with a net migration of iodine. Our work provides visual evidence for photo-induced halide migration in triiodide perovskites and reveals the complex interplay between charge carrier populations, electronic traps and mobile halides that collectively impact optoelectronic performance.