3 ms·
Only fully losslessly if the image dimensions are a multiple of the MCU (usually 8x8px or 16x16px, I can't recall/depends) any pixels part of a DCT block on the
by audrey1 2y ago
Only fully losslessly if the image dimensions are a multiple of the MCU (usually 8x8px or 16x16px, I can't recall/depends)
any pixels part of a DCT block on the edges are cropped when rendered, so jpegtran will drop those blocks when transforming the image since the alternative is introducing artifacts, since jpeg only supports cropping DCT blocks on the right and bottom edges.
I modified jpegtran to work as a dll and wrote a python wrapper for it for a project so I could use it in a small-image compression pipeline (due to several limitations with calling the binary). I needed to save a few hundred million 100x100 jpegs, so I overwrite the height/width to trick the decoder into thinking the edge blocks are full, then I stitch them into ~10x10 mega-images with my jpegtran wrapper, requantize with mozjpeg, then recompress with dropbox lepton, it saves about 20-30% overall, with each step saving about 10% each (the stitching benefits the lepton step).
https://i.imgur.com/6PV5WDM.jpeg https://i.imgur.com/6PV5WDM.jpeg
- 01HNNWZ0MV43FF 2y ago8 vs 16 Probably depends on whether chroma subsampling is enabled, off the top of my head