Retinal is the molecule found in photoreceptor cells that undergoes a change in shape when it absorbs light. Specifically, the cis/trans isomerization of a carbon-carbon double bond in this chromophore sets in motion the chain of biochemical processes responsible for vision. Here, we obtain atomically resolved images of individual structural isomers of the retinal chromophore attached to C60 molecules and study their dynamic behaviour inside a confined space--that is, inside single-walled carbon nanotubes--using high-resolution transmission electron microscopy (HR-TEM). Sequential HR-TEM images with sub-second time resolution directly reveal the isomerization between the cis and all-trans forms of retinal, as well as conformational changes and volume-conserving effects. This work opens up the possibility of investigating in vitro the biological activities of these photoresponsive molecules on an individual basis, and the molecular imaging technique described here is a general one that can be applied to a wide range of systems.