We compare experimentally determined porosity with values derived from X-ray tomography for a suite of eight sandstone varieties covering a porosity range from about 3 to 25 %. In addition, we performed conventional stereological analysis of SEM images and examined thin sections. We investigated the sensitivity of segmentation, the conversion of the tomographic gray-value images representing the obtained X-ray attenuation coefficients into binary images, to (a) resolution of the digital images, (b) denoising filters, and (c) seven thresholding methods. Images of sandstones with porosities of 15 5 to 25 % exhibit a bimodal intensity distribution of the attenuation coefficients, enabling unambiguous segmentation that gives porosity values closely matching the laboratory values. For samples with lower porosities, pores and grains do not separate well in the skewed unimodal intensity histograms. For these samples, all tested thresholding methods tend to miscalculate porosity significantly. In addition to absolute porosity, the ratio between pore size and resolution, and mineralogical composition of the rocks affect the biases of the global segmentation methods.