A method for image compression of a set of image data includes performing
a quantization operation on the image data. The quantization operation
may include controlling a compression factor by applying a scaled
quantization level obtained by multiplying a first quantization level by
a gain factor. The gain factor may be updated as a function of a bit per
pixel value of a compressed image. The update operation may include an
iterative procedure including at least one iteration step that provides
for updating a current gain factor as a function of a previous gain used
for performing a previous compression step and as a function of a ratio
of the bit per pixel value of the compressed image at the previous
compression step to a target bit per pixel value. The method may be used
in Joint Photographic Experts Group (JPEG) image processing and digital
still cameras.