Spectral shaping is critical to many fields of science. In astronomy for example, the detection of exoplanets via the Doppler effect hinges on the ability to calibrate a high resolution spectrograph. Laser frequency combs can be used for this, but the wildly varying intensity across the spectrum can make it impossible to optimally utilize the entire comb, leading to a reduced overall precision of calibration. To circumvent this, astronomical applications of laser frequency combs rely on a bulk optic setup which can flatten the output spectrum before sending it to the spectrograph. Such flatteners require complex and expensive optical elements like spatial light modulators and have non-negligible bench top footprints. Here we present an alternative in the form of an all-photonic spectral shaper that can be used to flatten the spectrum of a laser frequency comb. The device consists of a circuit etched into a silicon nitride wafer that supports an arrayed-waveguide grating to disperse the light over hundreds of nanometers in wavelength, followed by Mach-Zehnder interferometers to control the amplitude of each channel, thermo-optic phase modulators to phase the channels and a second arrayed-waveguide grating to recombine the spectrum. The demonstrator device operates from 1400 to 1800 nm (covering the astronomical H band), with twenty 20 nm wide channels. The device allows for nearly 40 dBs of dynamic modulation of the spectrum via the Mach-Zehnders , which is greater than that offered by most spatial light modulators. With a smooth spectrum light source (superluminescent diode), we reduced the static spectral variation to ∼3 dB, limited by the properties of the components used in the circuit. On a laser frequency comb which had strong spectral modulations, and some at high spatial frequencies, we nevertheless managed to reduce the modulation to ∼5 dBs, sufficient for astronomical applications. The size of the device is of the order of a US quarter, significantly cheaper than their bulk optic counter parts and will be beneficial to any area of science that requires spectral shaping over a broad range, with high dynamic range, including exoplanet detection.