As an addendum, we consider a real-world example of a page from the wild: the third page of “An Introduction to Mathematics” by A. N. Whitehead in https://www.gutenberg.org/files/41568/41568-pdf.pdf.
The commands magick -density 1200 "41568-pdf.pdf[2]" -quality 1 -define jpeg:arithmetic-coding=false -define jpeg:optimize-coding=true -define jpeg:dct-method=float -colorspace Gray -depth 8 Whitehead.magick.optimized_Huffman.jpg magick -density 1200 "41568-pdf.pdf[2]" -quality 1 -define jpeg:arithmetic-coding=true -define jpeg:dct-method=float -colorspace Gray -depth 8 Whitehead.magick.arithmetic.jpg magick -density 1200 "41568-pdf.pdf[2]" -colorspace Gray -depth 8 Whitehead.magick.pgm cjpeg -q 0 -grayscale -optimize -dct float -outfile Whitehead.cjpeg.optimized_Huffman.jpg -report -strict -verbose Whitehead.magick.pgm cjpeg -q 0 -grayscale -arithmetic -dct float -outfile Whitehead.cjpeg.arithmetic.jpg -report -strict -verbose Whitehead.magick.pgm dpi=1200 && exiftool -overwrite_original -JFIF:XResolution=$dpi -JFIF:YResolution=$dpi -JFIF:ResolutionUnit=inches Whitehead.cjpeg.arithmetic.jpg dpi=1200 && exiftool -overwrite_original -JFIF:XResolution=$dpi -JFIF:YResolution=$dpi -JFIF:ResolutionUnit=inches Whitehead.cjpeg.optimized_Huffman.jpg produce the following files: • Whitehead.magick.pgm: 42120017 bytes • Whitehead.cjpeg.arithmetic.jpg: 25742 bytes • Whitehead.cjpeg.optimized_Huffman.jpg: 182812 bytes • Whitehead.magick.arithmetic.jpg: 68647 bytes • Whitehead.magick.optimized_Huffman.jpg: 240160 bytes The savings exceed 7.1× for cjpeg and 3.4× for magick.

