We prove a general duality result showing that a Brascamp--Lieb type inequality is equivalent to an inequality expressing subadditivity of the entropy, with a complete correspondence of best constants and cases of equality. This open a new approach to the proof of Brascamp--Lieb type inequalities, via subadditivity of the entropy. We illustrate the utility of this approach by proving a general inequality expressing the subadditivity property of the entropy on $\R^n$, and fully determining the cases of equality. As a consequence of the duality mentioned above, we obtain a simple new proof of the classical Brascamp--Lieb inequality, and also a fully explicit determination of all of the cases of equality. We also deduce several other consequences of the general subadditivity inequality, including a generalization of Hadamard's inequality for determinants. Finally, we also prove a second duality theorem relating superadditivity of the Fisher information and a sharp convolution type inequality for the fundamental eigenvalues of Schrödinger operators. Though we focus mainly on the case of random variables in $\R^n$ in this paper, we discuss extensions to other settings as well.