We propose a method to demosaick images acquired with a completely arbitrary color filter array (CFA). We adopt a variational approach where the reconstructed image has maximal smoothness under the constraint of consistency with the measurements. This optimization problem boils down to a large, sparse system of linear equations to solve, for which we propose an iterative algorithm. Although the approach is linear, it yields visually pleasing demosaicked images and provides a robust framework for comparing the performances of CFAs.