tags:

views:

66

answers:

1

How can I compose (adjoin) multiple JPEG files without re-compression?

I know there is jpegtran that can losslessly crop and resize JPEG images, so I wonder if there is similar tool to adjoin images lossless?

Their size is a multiple 1 MCU block (16 pixels in both directions).

+1  A: 

I've used ImageMagick's composite binary to watermark a JPG with a PNG image.

Like this:

composite -tile -dissolve 15 targetimage.jpg watermark.png

You can obviously use two JPEGs to achieve what you're looking for.

Using the -quality and -sampling-factor arguments will help retain quality. There is also a -compress <type> argument, where type can by Lossless. However, ImageMagick does not recommend the use of this value as the JPEG library must be patched to support this.

It's worth investigating though if it will achieve a genuine lossless image, and you're not happy with the quality of the compress and sampling-factor arguments.

abrereton
No, that's not what I am looking for, because it will cause re-compression and associated quality drop.
sanmai
OK. I've never come across a method to perform a lossless composition of two images. I'd be surprised if there is a way to do this, as you are creating a new image. I'll be interested to see what other people have to say.
abrereton