Flat beams -- beams with asymmetric transverse emittances -- have important applications in novel light-source concepts, advanced-acceleration schemes and could possibly alleviate the need for damping rings in lepton colliders. Over the last decade, a flat-beam-generation technique based on the conversion of an angular-momentum-dominated beam was proposed and experimentally tested. In this paper we explore the production of compressed flat beams. We especially investigate and optimize the flat-beam transformation for beams with substantial fractional energy spread. We use as a simulation example the photoinjector of the Fermilab's Advanced Superconducting Test Accelerator (ASTA). The optimizations of the flat beam generation and compression at ASTA were done via start-to-end numerical simulations for bunch charges of 3.2 nC, 1.0 nC and 20 pC at ~37 MeV. The optimized emittances of flat beams with different bunch charges were found to be 0.25 {\mu}m (emittance ratio is ~400), 0.13 {\mu}m, 15 nm before compression, and 0.41 {\mu}m, 0.20 {\mu}m, 16 nm after full compression, respectively with peak currents as high as 5.5 kA for a 3.2-nC flat beam. These parameters are consistent with requirements needed to excite wakefields in asymmetric dielectric-lined waveguides or produce significant photon flux using small-gap micro-undulators.