JPEG compression steps after quantization
Ok what's left is the last stage; namely Huffman VLC (variable length code) coding of those quantized DCT coefficients. And indeed it's true that the actual bit savings are obtained in this last stage.

As you may recognize, after the zig-zag scanning stage, there should be long chains of zeros among those 64 quantized DCT coefficients. By taking advantage of those chained zeros, you will encode those zig-zag scanned coefficients according to some CAT and SYM codewords, specifically designed and provided by the JPEG standards committee as a Huffman Table.

The procedure is longer than I wish to lay out here, but not very complex. I highly recommend anyone interested in implementing a standard JPEG the following books


1-) Stanard Codecs_GHANBARI
2-) Introduction to Data Compression_SAYOOD.