Page 1 of 1

Select more than one layer from TIFF and output a flattened JPG

Posted: 2019-06-05T07:59:11-07:00
by thdbased
I have an input file, the file itself I cannot share due to the contents.
The file is a TIFF which contains 4 layers:

Code: Select all

.\image.tif[0] TIFF 4166x3315 4166x3315+0+0 8-bit sRGB 102.1MB 0.250u 0:00.243
.\image.tif[1] TIFF 4166x3315 4166x3315+0+0 8-bit sRGB 102.1MB 0.016u 0:00.028
.\image.tif[2] TIFF 2920x106 2920x106+669+2996 8-bit Grayscale Gray 102.1MB 0.016u 0:00.044
.\image.tif[3] TIFF 2873x2788 2873x2788+672+309 8-bit sRGB 102.1MB 0.016u 0:00.059
I want to take the first two layers and have a JPG output with those two layers flattened as a result.
I can take each layer individually without a problem, but more than one I cannot find how.

Many thanks :)

Re: Select more than one layer from TIFF and output a flattened JPG

Posted: 2019-06-05T08:34:58-07:00
by snibgo

Code: Select all

magick image.tif[0] image.tif[1] -layers Flatten out.jpg

Re: Select more than one layer from TIFF and output a flattened JPG

Posted: 2019-06-05T09:33:57-07:00
by thdbased
Thx, will give that a try.

Re: Select more than one layer from TIFF and output a flattened JPG

Posted: 2019-06-05T11:05:11-07:00
by GeeMack
thdbased wrote:
2019-06-05T09:33:57-07:00
Thx, will give that a try.
The answer snibgo gave above is about as simple as you can get. Keep in mind you can include more than one index inside the square brackets, and those indexes can be in the order you want to read the images. This command would read in the second image before the first...

Code: Select all

magick image.tif[1,0] -layers Flatten out.jpg
In other words, the first two images will be read with that command in the order 1 then 0, so the second image will be flattened onto the first.