Reversible formation and destruction of H-type aggregates of an anionic porphyrin can be controlled exclusively through light inputs of different energy exploiting the different interactions with the two isomeric forms of a cationic photoresponsive azobenzene-based surfactant.