The JPEG baseline algorithm codes the dc of a block by giving its difference with the dc of the previous block. We propose to use ac coefficients for this purpose. Our method computes the difference of the sum of pixels of two boundary columns (or rows), one belonging to the current block and the other to a previous block, and then manipulates it in the direct cosine transform (DCT) domain so that the average of the coded differences for the whole image is near zero. Experimental results show that our method reduces the average JPEG dc residual by about 75% for images compressed at the default quality level. The reduction is even higher for unquantized DCT blocks.