Disclosed in a system and method for segmenting foreground pixel from background pixels in a digital image, specifically a fingerprint image. First the image is divided into blocks of optimal size. Then, for a given block, an overall gradient magnitude and a projected gradient magnitude is determined. The overall gradient magnitude is a measure of the amount of intensity variation in the current block. If a large number (or all) of the pixels have a direction that is the same as the overall gradient direction, the projected gradient magnitude will be nearly equal (will be equal) to the overall gradient magnitude. This indicates that the current block is a block in the foreground of the image. A relationship, e.g., a ratio, of the over gradient magnitude to the overall projected gradient magnitude is taken certainty level that the current block is in the foreground or background of the image. Connected blocks making up the largest region of foreground blocks are considered the foreground region, the rest of the blocks/regions are discarded (considered as background).