The inverse spinel ferrimagnets CoFe2O4 (CFO) and NiFe2O4 (NFO) are of interest for applications in spin-filter devices or as building blocks of artificial multiferroic heterostructures. Here we present density functional theory calculations of the structural and magnetic properties of CFO and NFO, with special emphasis on strain-induced changes in the magneto-crystalline anisotropy energy. We find that tensile (compressive) strain favours perpendicular (in-plane) anisotropy, in agreement with experimental observations. Our calculated magnetostriction constants λ100 agree well with available experimental data. Furthermore, the influence of different cation arrangements used to represent the inverse spinel structure and the effect of different exchange-correlation functionals are analysed and discussed.