We demonstrate improved detection of small trapped atomic ensembles through advanced postprocessing and optimal analysis of absorption images. A fringe-removal algorithm reduces imaging noise to the fundamental photon-shot-noise level and proves beneficial even in the absence of fringes. A maximum-likelihood estimator is then derived for optimal atom-number estimation in well-localized ensembles and is applied to real experimental data to measure the population differences and intrinsic atom shot noise between spatially separated ensembles each comprising between 10 and 2000 atoms. The combined techniques improve our signal-to-noise ratio by a factor of 3, to a minimum resolvable population difference of 17 atoms, close to our ultimate detection limit.