When a molecule interacts with light, its electrons can absorb energy from the electromagnetic field by rapidly rearranging their positions. This constitutes the first step of photochemical and photophysical processes that include primary events in human vision and photosynthesis. Here, we report the direct measurement of the initial redistribution of electron density when the molecule 1,3-cyclohexadiene (CHD) is optically excited. Our experiments exploit the intense, ultrashort hard x-ray pulses of the Linac Coherent Light Source (LCLS) to map the change in electron density using ultrafast x-ray scattering. The nature of the excited electronic state is identified with excellent spatial resolution and in good agreement with theoretical predictions. The excited state electron density distributions are thus amenable to direct experimental observation.