In this study, we investigated the picosecond optical pulse generation from a 1064-nm distributed feedback laser diode under strong gain switching. The spectrum of the generated optical pulses was manipulated in two different ways: (i) by extracting the short-wavelength components of the optical pulse spectrum and (ii) by compensating for spectral chirping in the extracted mid-spectral region. Both of these methods shortened the optical pulse duration to approximately 7 ps. These optical pulses were amplified to over 20-kW peak power for two-photon microscopy. We obtained clear two-photon images of neurons in a fixed brain slice of H-line mouse expressing enhanced yellow fluorescent protein. Furthermore, a successful experiment was also confirmed for in vivo deep region H-line mouse brain neuron imaging.