Many mass spectrometry imaging (MSI) applications such as infrared matrix-assisted electrospray ionization (IR-MALDESI) employ an infrared (IR) laser with a Gaussian profile where laser irradiance is highest in the center and decreases exponentially. To enable full ablation of a square region of interest, oversampling is often needed, which results in nonuniform ablation and leads to decreased image quality. A diffractive optical element (DOE) was integrated into the optical path to generate homogeneous intensity distributions while maintaining laser energy above the ablation threshold, to enable complete sample removal from laser pulses without oversampling. 2D and 3D imaging with the DOE inserted show clear and sharp ablation patterns with satisfactory biological signals gained. Further improvements will optimize the beam profile and generate a square top-hat laser beam for MSI application at higher spatial resolution.