We compute QCD corrections to the production of a ttbar pair in association with a hard photon at the Tevatron and the LHC. This process allows a direct measurement of the top quark electromagnetic couplings that, at the moment, are only loosely constrained. We include top quark decays, treating them in the narrow width approximation, and retain spin correlations of final-state particles. Photon radiation off top quark decay products is included in our calculation and yields a significant contribution to the cross-section. We study next-to-leading order QCD corrections to the ppbar -> ttbar+gamma process at the Tevatron for the selection criteria used in a recent measurement by the CDF collaboration. We also discuss the impact of QCD corrections to the pp -> ttbar+gamma process on the measurement of the top quark electric charge at the 14 TeV LHC.