I'm trying to implement JPEG compression in python and so far I have done the following steps Color Space conversion Downscaling chrominance channels 8x8 block splitting ( adds padding if size is not perfect ) DCT Quantization ZigZag Ordering runlength encoding on ac coefficients, transformed into (RUNLENGTH, SIZE)(AMPLITUDE) pattern e.g [(0, 2), -2, (4, 1), 1, (0, 0)] DPCM on dc cofficients I'm a lil confused about 2 things. how should I encode the dc coefficients before Huffman encoding. Is there a specific pattern just like ac coefficients? After encoding dc coefficients are stored in their respective blocks ? [dc],[ac_value],.... or all dc values are stored separately and Huffman encoded separately [dc value,...] [ac values,...] I read that fixed huffman tables are used by most encoders. Where exactly can I find the fixed standard huffman tables. I'm not sure if I am missing any crucial steps so far? Continue reading...