Usable JPEG compression with [1,1,1,...,1] as quantization table.
In http://imagemagick.org/discourse-server ... 22&t=20333, I discuss numerous attempts at improving JPEG compression quantization matrices, many of them in the -sampling-factor 1x1 case. (I'd like to avoid the 2x2 colour artifacts caused by chroma blocks larger than luma blocks, artifacts which may be quite severe at reasonable quality.)
If you've followed the above thread, it may come as a surprise that I'm quite happy with the following quantization matrix:
Code: Select all
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
Key trick: Use progressive encoding to scale the DCT coefficients.
Cjpeg example which actually does work quite well with -sample 1x1, the equivalent of ImageMagick's -sampling-factor 1x1.
Save the above matrix of ones in a text file ("qtable.txt", for example). Also save what's below in another text file ("scans.txt", for example):
Code: Select all
# Nicolas Robidoux's progressive encoding v2012.02.26
# for -sample 1x1 (too few chroma values for 2x2)
0: 0 0 0 3;
1: 0 0 0 3;
2: 0 0 0 2;
0: 1 1 0 2;
0: 2 2 0 2;
2: 1 2 0 2;
0: 3 5 0 2;
1: 1 2 0 3;
0: 6 20 0 3;
0: 21 35 0 4;
0: 36 63 0 5;
Code: Select all
cjpeg -baseline -optimize -dct float -quality 100 -sample 1x1 -scans scans.txt -qtables qtable.txt -qslots 0 -outfile fido.jpg original.ppm
Code: Select all
cjpeg -baseline -optimize -dct float -quality 78 -outfile stock.jpg original.ppm
- Effectively, a low pass filter is applied to it, and consequently it shows less "JPEG block ripples" and fine details than the image produced with the standard.
Overall, the result looks much better when enlarged than the stock image (unless you want fine detail, of course). - it not show the usual wide "red/green bands/checkerboard artifacts" associated with -sampling-factor 2x2.
Code: Select all
convert bedroom_huffman.jpg original.ppm