Page 1 of 1

Combine images to tiff

Posted: 2018-11-20T03:24:22-07:00
by asdfgh41
I have multiple image which is different compressed. I want to merge this files to single tif file. Can i use the different compression methods for them while merging.

For example
Image1.tif compression => Group4
Image2.tif compression => Jpeg with 16 quality

I want single tiff image with scene 1 group4, scene 2 is jpeg with 16 quality.

Code: Select all

convert "Image1.tif" "Image2.tif" -adjoin "result.tif"
For example i have a tif file merged by different tool. Identify result is below
Scene: 0 of 2
Compression: Group4

Scene: 1 of 2
Compression: JPEG

Re: Combine images to tiff

Posted: 2018-11-20T05:11:43-07:00
by snibgo
When writing a number of images to a single tif, IM has no mechanism for requesting a different compression for each image. "-compress" applies to all the images in the file.

You can use IM to save each image to its own tif, with different compressions. Then use an external tool such as tiffcp to merge the tifs into a single file, with mixed compressions.

Re: Combine images to tiff

Posted: 2018-11-20T05:23:08-07:00
by 246246
As far as I know, it was impossible. See viewtopic.php?f=1&t=32672 or https://imagemagick.org/discourse-serve ... =3&t=34326
Use tiffcp instead.

However it should become possible now after some recent update: viewtopic.php?f=3&t=34466

Code: Select all

$ magick -version
Version: ImageMagick 7.0.8-14 Q16 x86_64 2018-11-06 https://imagemagick.org
Copyright: © 1999-2018 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC HDRI Modules OpenMP
Delegates (built-in): bzlib cairo djvu fftw flif fontconfig freetype gslib gvc jbig jng jp2 jpeg lcms lqr ltdl lzma openexr pangocairo png ps raw rsvg tiff webp wmf xml zlib

Code: Select all

$ magick logo: -compress Group4 logo4.tif
$ magick logo: -compress Zip logoZ.tif
$ magick logo4.tif logoZ.tif logo4+Z.tif
$ magick identify -format '%C\n' logo4+Z.tif
Group4
Zip
However,

Code: Select all

$ magick logo: -compress Jpeg logoJ.tif
$ magick identify -format '%C\n' logoJ.tif
JPEG
$ magick logo4.tif logoJ.tif logo4+J.tif
$ magick identify -format '%C\n' logo4+J.tif
Group4
None
So, I think this is a bug at least for Jpeg compression.

Code: Select all

$ tiffcp logo4.tif logoJ.tif logo4+J-2.tif
$ magick identify -format '%C\n' logo4+J-2.tif
Group4
JPEG

Re: Combine images to tiff

Posted: 2018-11-20T06:01:20-07:00
by snibgo
246246 wrote:However it should become possible now after some recent update:
Thanks, I had forgotten that. (And I haven't yet upgraded to include that update.)