Stochastic optical fluctuation imaging (SOFI) is a super-resolution fluorescence imaging technique that makes use of stochastic fluctuations in the emission of the fluorophores. During a SOFI measurement multiple fluorescence images are acquired from the sample, followed by the calculation of the spatiotemporal cumulants of the intensities observed at each position. Compared to other techniques, SOFI works well under conditions of low signal-to-noise, high background, or high emitter densities. However, it can be difficult to unambiguously determine the reliability of images produced by any superresolution imaging technique. In this work we present a strategy that enables the estimation of the variance or uncertainty associated with each pixel in the SOFI image. In addition to estimating the image quality or reliability, we show that this can be used to optimize the signal-to-noise ratio (SNR) of SOFI images by including multiple pixel combinations in the cumulant calculation. We present an algorithm to perform this optimization, which automatically takes all relevant instrumental, sample, and probe parameters into account. Depending on the optical magnification of the system, this strategy can be used to improve the SNR of a SOFI image by 40% to 90%. This gain in information is entirely free, in the sense that it does not require additional efforts or complications. Alternatively our approach can be applied to reduce the number of fluorescence images to meet a particular quality level by about 30% to 50%, strongly improving the temporal resolution of SOFI imaging.