Combine images to tiff

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
asdfgh41
Posts: 5
Joined: 2018-11-02T05:03:49-07:00
Authentication code: 1152

Combine images to tiff

Post 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
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Combine images to tiff

Post 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.
snibgo's IM pages: im.snibgo.com
246246
Posts: 190
Joined: 2015-07-06T07:38:22-07:00
Authentication code: 1151

Re: Combine images to tiff

Post 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
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Combine images to tiff

Post 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.)
snibgo's IM pages: im.snibgo.com
Post Reply