A search for physics beyond the standard model in final states with at least one photon, large transverse momentum imbalance, and large total transverse event activity is presented. Such topologies can be produced in gauge-mediated supersymmetry models in which pair-produced gluinos or squarks decay to photons and gravitinos via short-lived neutralinos. The data sample corresponds to an integrated luminosity of 35.9 fb−1 of proton-proton collisions at s=13 TeV recorded by the CMS experiment at the LHC in 2016. No significant excess of events above the expected standard model background is observed. The data are interpreted in simplified models of gluino and squark pair production, in which gluinos or squarks decay via neutralinos to photons. Gluino masses of up to 1.50-2.00 TeV and squark masses up to 1.30-1.65 TeV are excluded at 95% confidence level, depending on the neutralino mass and branching fraction.[Figure not available: see fulltext.].