multilayer tif to flattened Tif

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
johanwieland
Posts: 3
Joined: 2018-09-27T03:48:27-07:00
Authentication code: 1152

multilayer tif to flattened Tif

Post by johanwieland »

A Tif with 2 or more layers (generated by Photoshop CC 2018) can easily be flattened to png, jpg, etcetc. But to convert multilayer.tif to singlelayer.tif is not succesfull, the result of

Code: Select all

magick multilayer.tif -flatten flattened.tif 
has the same layerstructure.
Tested it with different versions of IM 6.99, 7.06 and 7.08 (6.99 only on Macintosh platform, the 7.x version on Windows server
Does anyone has a solution for this?
Regards, Johan
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: multilayer tif to flattened Tif

Post by fmw42 »

Can you post your input TIFF file to some free hosting service that will not change the format (for example try dropbox.com) or zip the file before posting and then put the URL here so the Imagemagick developers can test with it.
johanwieland
Posts: 3
Joined: 2018-09-27T03:48:27-07:00
Authentication code: 1152

Re: multilayer tif to flattened Tif

Post by johanwieland »

A sample multilayer-tif on dropbox:
https://www.dropbox.com/s/b1wcqvn2xd60c ... m.tif?dl=0
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: multilayer tif to flattened Tif

Post by fmw42 »

I can confirm that the flattened tif still has two layers. Tested using Imagemagick 7.0.8.12 Q16 Mac OSX Sierra and checking with Photoshop.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: multilayer tif to flattened Tif

Post by fmw42 »

Here is a workaround that seems to produce a 1-layer tif

Code: Select all

convert rotterdam.tif PSD:- | convert - -flatten result.tif
johanwieland
Posts: 3
Joined: 2018-09-27T03:48:27-07:00
Authentication code: 1152

Re: multilayer tif to flattened Tif

Post by johanwieland »

That seems to work, but with a strange side effect: some metadata disappeared.
In the File Info/Origin i gave the fields CITY and Country a value. And that is gone after the convert. But Copyright Info URL kept his value.
converting from tif to psd seems to change some metadatafields.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: multilayer tif to flattened Tif

Post by fmw42 »

It was a crude workaround. A proper enhancement to handle layered tiffs is needed to do it correctly.
Post Reply