A method is for compressing a digital image including a matrix of
elements, with each element including at least one component of a
different type for representing a pixel. The method includes splitting
the digital image into a plurality of blocks, and calculating for each
block a group of discrete cosine transform (DCT) coefficients for the
components of each type, and quantizing the DCT coefficients of each
group using a corresponding quantization table scaled by a gain factor
for achieving a target compression factor. The method also includes
further quantizing the DCT coefficients of each group using the
corresponding quantization table scaled by a pre-set factor, and
arranging the further quantized DCT coefficients in a zig-zig vector.