mosaic jpegs w/ size a multiple of tile size w/o recompres
Posted: 2011-05-19T10:57:40-07:00
Suppose that you have a collection of jpeg thumbails with fixed width and height, both of them an exact multiple of the tile size (8 if using -sampling-factor 1x1 and 16 if using -sampling-factor 2x2).
For example, a collection of 40x40 JPEG thumbnails done using -sampling-factor 1x1 (and somewhat low quality).
Is there an easy way to assemble them into a mosaic jpeg strip (vertical or horizontal) without decompression/recompression artifacts?
My understanding is that generically the individual thumbnails will be decompressed, assembled into a mosaic, and then recompressed, and this will introduce artifacts, even if the JPEG parameters are the same across the board.
What I want to do is exploit the fact that JPEG compression is done one tile at a time, so the result, in principle, should be the same if I assemble the mosaic "directly." I'm guessing it's not (but have not checked yet).
(I actually am assuming that the usual ways of assembling the mosaic would be lossy. Is IM smart enough to assemble losslessly without special handling in my special case? Of course, if you have dimensions VS JPEG tile mismatch, doing this losslessly is basically impossible within the JPEG framework.)
For example, a collection of 40x40 JPEG thumbnails done using -sampling-factor 1x1 (and somewhat low quality).
Is there an easy way to assemble them into a mosaic jpeg strip (vertical or horizontal) without decompression/recompression artifacts?
My understanding is that generically the individual thumbnails will be decompressed, assembled into a mosaic, and then recompressed, and this will introduce artifacts, even if the JPEG parameters are the same across the board.
What I want to do is exploit the fact that JPEG compression is done one tile at a time, so the result, in principle, should be the same if I assemble the mosaic "directly." I'm guessing it's not (but have not checked yet).
(I actually am assuming that the usual ways of assembling the mosaic would be lossy. Is IM smart enough to assemble losslessly without special handling in my special case? Of course, if you have dimensions VS JPEG tile mismatch, doing this losslessly is basically impossible within the JPEG framework.)