We propose and demonstrate a method to gauge and optimize the signal-to-noise ratios (SNRs) in lensless imaging using partially coherent sources. Through spatial filtering we tuned the coherence width of an incoherent soft x-ray undulator source, and we deduce that there exists an optimal spatial filter setting for imaging micrometer-sized objects, while high-resolution imaging is best executed without spatial filtering. Our SNR analysis, given spatial coherence, allows for an estimation of the required exposure time at synchrotron sources and pulse fluence at x-ray laser sources.