The Compton Spectrometer and Imager (COSI) is a Compton telescope designed to study the soft gamma-ray sky (0.2-5 MeV) and observe astrophysical sources of nuclear-line emission, measure polarization of gamma-ray bursts (GRBs), accreting black holes, and pulsars, as well as detect and localize multimessenger sources. Processing the data from measurements to images and spectra ready for scientific interpretation requires a well-understood detector setup and a multi-step data-analysis pipeline. The pipeline needs to include simulations which are well benchmarked with detailed instrument calibrations, approaches to reconstruct the paths of the gamma rays via multiple scatters (2-7) in the detector and to qualify the events, tools to create response files and an adequate in-flight background model, and finally, image deconvolution approaches. We have developed all of these capabilities for COSI and evaluated them with observational data from the 2016 COSI balloon flight of the 511-keV positron annihilation line as well as the Crab pulsar and nebula. Significant advances in detector technology and analysis methods and capabilities since COSI’s predecessor missions, COMPTEL and INTEGRAL, enable much more sensitive observations of the gamma-ray sky, especially by a future COSI SMEX space mission.