Page 1 of 1

Convert .tif with layers in .png

Posted: 2016-10-21T00:54:48-07:00
by hank
Hi,

i'm searching for a smart solution for converting tif files, cmyk, with 2 or more layers, without clipping path or any separate masks and no background (transparent) in a png with transparency

I found this here:
convert test_file.tif \( -clone 0 -alpha on -channel rgba -evaluate set 0 \) \( -clone 1 \) -delete 0,1 -background none -flatten test_file.png

It works for me, if my test file has just one layer... but usually our files have more than one.

Can anyone help me? Cause i don't really understand all parameters or scripting at all :-(

Thanks

Re: Convert .tif with layers in .png

Posted: 2016-10-21T00:58:15-07:00
by hank
Oh, i'm using ImageMagick 6.9.6-2 Q16 x86_64 2016-10-21

Re: Convert .tif with layers in .png

Posted: 2016-10-21T01:12:31-07:00
by snibgo
When you tiff has two layers, what output(s) do you want? Perhaps one png per layer, as if they were entirely separate images. Or perhaps you want a single png output, by combining the layers in some way.

Re: Convert .tif with layers in .png

Posted: 2016-10-21T01:17:44-07:00
by hank
The result should be a single png with the layers combined.

Re: Convert .tif with layers in .png

Posted: 2016-10-21T01:43:20-07:00
by snibgo
Okay. Combined in what way?

Perhaps:

Code: Select all

convert in.tif -layers merge out.png

Re: Convert .tif with layers in .png

Posted: 2016-10-21T01:56:02-07:00
by hank
Okay, the combination of the layers is right, thanks, but now my background ist white.

Re: Convert .tif with layers in .png

Posted: 2016-10-21T02:01:53-07:00
by hank
if i try this
convert test.tif \( -clone 0 -alpha on -channel rgba -evaluate set 0 \) \( -clone 1 \) -delete 0,1 -background none -layers merge test.png

Almost everything looks fine, just the sequence of the layers is wrong

Re: Convert .tif with layers in .png

Posted: 2016-10-21T02:08:28-07:00
by hank
I found the solution for my problem

convert test.tif \( -clone 0 -alpha on -channel rgba -evaluate set 0 \) -delete 0 -background none -layers merge test.png

Re: Convert .tif with layers in .png

Posted: 2016-10-21T02:18:36-07:00
by snibgo
hank wrote:... but now my background ist white.
Then use "-background none":

Code: Select all

convert in.tif -background none -layers merge out.png
Glad you've found a solution, but it looks as if it will ignore the first image in the tiff.

Re: Convert .tif with layers in .png

Posted: 2016-10-21T02:28:18-07:00
by hank
-background none doesn't work.
Don't know why