The complex reaction of thermally generated iminopropadienones with amines in the gas phase and upon matrix deposition and its varying product composition is investigated using density functional theory. In the high energy gas phase addition a single amine molecule reacts readily with iminopropadienone with the decisive step being a 1,3-hydrogen shift and activation barriers of at least 100 kJ/mol. In accordance with the experiment, the formation of ketenes is favored. In the condensed phase of an amine matrix, the utilization of amine dimers both as reagents and as explicit solvents lowers the activation energy required to a feasible 20-30 kJ/mol and predicts ketenimines as the main products, as observed experimentally.