A method and apparatus is described for segmenting an image, for
adaptively scaling an image, and for automatically scaling and cropping
an image based on codestream headers data. In one embodiment, a file that
can provide a header that contains multi-scale entropy distribution
information on blocks of an image is received. For each block, the block
is assigned to a scale from a set of scales that maximizes a cost
function. The cost function is a product of a total likelihood and a
prior. The total likelihood is a product of likelihoods of the blocks.
The image is segmented by grouping together blocks that have been
assigned equivalent scales. In one embodiment, the file represents an
image in JPEG 2000 format.