We report on the magnetization reversal mechanism of Co islands on Pt(111) as a function of their size and shape. We measure the zero-field susceptibility chi(T) and low-temperature magnetization curves M(H) with in situ magneto-optical Kerr effect. Together with the island morphology deduced from scanning tunneling microscopy, this creates sufficient information to determine both the magnetization reversal mechanism and the distribution of anisotropy energies between perimeter and surface atoms. We find a transition from quasicoherent rotation to domain wall nucleation and propagation with a critical size of 350 atoms for ramified, and of 600 atoms for compact islands.