Spatial control of microstructure within a three-dimensional component has been a dream of materials scientists for centuries. However, limitations in traditional manufacturing processes prevent detailed control over the distribution of microstructures in a single part. Here, we demonstrate the ability to control grain structure and crystallographic texture during metal additive manufacturing for arbitrary cross-sections of a practical size, with profound implications for the design and optimization of next-generation products. The key to this advance is a new geometry agnostic scan path algorithm that manipulates the spatial distribution of solidification conditions. Utilizing a fundamental understanding of solidification dynamics and a model of the heat transfer during processing, we have designed this algorithm to manipulate the natural competition between epitaxial dendrite growth and grain nucleation. With this algorithm, we successfully controlled the grain structure of Ni-based superalloy IN718 in the shape of the Mona Lisa.