A method and apparatus for adjusting the contrast of an image, in which
each pixel in the image has an initial brightness level that is within a
range of brightness levels between a minimum brightness level and a
maximum brightness level. For each brightness level within the range, the
number of pixels that have the same initial brightness level is counted.
The pixels are divided into at least two types by identifying the or each
set of pixels having initial brightness levels in which each of a
plurality of adjacent ones of said brightness levels has more pixels than
a threshold number. The pixels of the plurality of adjacent ones of said
brightness levels are treated as a first type. The remaining pixels are
treated as a second type. For the or each set of pixels of the first
type, contrast enhancement is carried out separately on those pixels.