Page 1 of 1

Can't flatten tif files???

Posted: 2013-11-21T11:03:13-07:00
by baraka2000
Hi,

I'm trying to do something very simple with IM. But no matter what command I try I can't seem to hack it. I'm very simply trying to flatten a layered tif/tiff file. This file is created in PS. I can't post this particular file because it's a celeb and I'd get in trouble, but suffice to say its just a layered tiff and I want to flatten it.

I've tried:
convert -flatten -background white in.tif out.tif
convert -flatten in.tif out.tif
convert in.tif -layers out.tif
convert in.tif -alpha off -layers flatten out_file.tif
convert in.tif -flatten
convert in.tif -flatten out.tif

I get these errors (which I've read doesn't mean anything and can be ignored...)

convert: Incompatible type for "RichTIFFIPTC"; tag ignored. `TIFFFetchNormalTag' @ warning/tiff.c/TIFFWarnings/837.
convert: Unknown field with tag 306 (0x132) encountered. `TIFFReadCustomDirectory' @ warning/tiff.c/TIFFWarnings/837.
convert: Incompatible type for "FileSource"; tag ignored. `TIFFFetchNormalTag' @ warning/tiff.c/TIFFWarnings/837.
convert: Incompatible type for "SceneType"; tag ignored. `TIFFFetchNormalTag' @ warning/tiff.c/TIFFWarnings/837.
convert: Incompatible type for "RichTIFFIPTC"; tag ignored. `TIFFFetchNormalTag' @ warning/tiff.c/TIFFWarnings/837.

I've read all the related threads, tried the above commands, no luck. Any help here would be helpful.
Thanks,
Kevin

Re: Can't flatten tif files???

Posted: 2013-11-21T11:28:36-07:00
by snibgo

Code: Select all

convert in.tif -flatten out.tif
... should do it. But you have tried that. What happened instead of the expected result?

What version of IM on what platform?

Re: Can't flatten tif files???

Posted: 2013-11-21T11:40:18-07:00
by Bonzo
I can't post this particular file because it's a celeb and I'd get in trouble
If you created the tiff file or somebody in your organisation created it why not create another one that is not sensitive and post a link to that?

Re: Can't flatten tif files???

Posted: 2013-11-21T14:03:37-07:00
by baraka2000
I've pasted over the sensitive stuff in this image. I did try with a different image and did get things to work. So my guess if the iptc errors are preventing IM from doing it's thing. But how to get around this?

Here's the file in question: https://www.hightail.com/download/OGhkZ ... WGNPd3NUQw

Version: ImageMagick 6.6.9-7
TIFF* TIFF rw+ Tagged Image File Format (LIBTIFF, Version 3.9.5)
TIFF64* TIFF --- Tagged Image File Format (64-bit) (LIBTIFF, Version 3.9.5)

And a few other questions, I was planning to just run this command on all tif files we receive (some layered, most not) but in the interest of saving processing time, is there a way to check for layers with IM, and if true then run the flatten command??

Lastly can I overwrite the input file with the flat version, eg no output file??

Thanks!
Kevin

Re: Can't flatten tif files???

Posted: 2013-11-21T15:50:18-07:00
by fmw42
This seems to work fine for me on IM 6.8.7.6 Q16 Mac OSX and LIBTIFF, Version 4.0.3

convert Shot_03_Single_034.tif -background black -flatten Shot_03_Single_034.png

It is either your version of IM or libtiff or both that may be too old. Can you upgrade

check your version of libtiff

tiffinfo
LIBTIFF, Version 4.0.3
...

Re: Can't flatten tif files???

Posted: 2013-11-21T16:09:47-07:00
by snibgo
Here's the file in question: https://www.hightail.com/download/OGhkZ ... WGNPd3NUQw
That file contains only one image, with no transparency. What do you expect flatten to do? What do you want it to do?

Re: Can't flatten tif files???

Posted: 2013-11-21T16:22:49-07:00
by fmw42
The tiff file opened in PS shows several layers. I suspect IM is flattening them already, since it probably does not know about grouped layers. In any case, my result from IM, which as snibgo says sees only one layer in the original when opened, looks exactly like what you see in PS with all layers on (or if you were to flatten or merge them all).

Re: Can't flatten tif files???

Posted: 2013-11-22T09:38:58-07:00
by baraka2000
So I gave you my server IM version, I forgot I was in a ssh session when I checked...

But my testing has all been local on my Mac 10.8.5 with:

TIFF* TIFF rw+ Tagged Image File Format (LIBTIFF, Version 4.0.3)
TIFF64* TIFF rw- Tagged Image File Format (64-bit) (LIBTIFF, Version 4
ImageMagick 6.8.7-0 2013-11-11 Q16 http://www.imagemagick.org

I tried upgrading using Home Brew, and it seems to think this is the latest... Obviously it's not.

And yes I can convert to a png or jpg and it flattens as expected, but I didn't want to have to worry about the name changing in my logic so I prefer to just keep it a tiff... I would gues converting to jpg or png wouldn't even require the flatten option sense they can't handle layers....

But that's not what I'm trying to do, I just want to flatten a layered PS tiff... surprised this doesn't work tbh.

But at least I know it's not just my newbism to IM...

Thanks everyone for taing the time to help!

Re: Can't flatten tif files???

Posted: 2013-11-22T09:52:40-07:00
by snibgo
It seems there are different ways that Photoshop can save layers in tiff files. Sometimes they are saved as separate images, and IM can then see each one. But sometimes ("grouped layers"?) Photoshop saves the layers in such a way that IM, exiftool and Gimp can see only one layer.

Re: Can't flatten tif files???

Posted: 2013-11-22T09:54:04-07:00
by baraka2000
Another update:

I tried:

Code: Select all

convert Shot_03_Single_034.tif -flatten out.tif
But when I open the out.tif in PS I see all layers alive and kicking.

Looks like I'll have to live with the name change and go png...

Re: Can't flatten tif files???

Posted: 2013-11-22T09:58:14-07:00
by baraka2000
#snibgo thanks for your insight.

I guess I'm surprised it doesn't just throw anything it can't see away... It must be doing that on some level when going to png...

I'll stick with the png solution I guess. Thanks everyone!

Hope this helps someone in the future as I googled my heart out trying to figure this one out...