Multi layered 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?".
belimlin
Posts: 4
Joined: 2014-12-27T05:27:55-07:00
Authentication code: 6789

Multi layered TIFF?

Post by belimlin » 2014-12-27T05:50:02-07:00

At this url: http://xoio-air.de/2013/cutout-people-g ... n-sitting/,
the authors are freely distributing self-made cotout textures for usage in 3D programs (such as 3dsMAX or Blender).
The images are distributed as multi layered TIFFs with alpha layer. I am a linux/completely-opensource app user, and
as it turns out, NONE of the apps available as non-proprietary on linux repositores sees those layers. All apps,
including Gimp with all of its plugins, eom, Geeqie, Luminance, Converseen, commandline libtiff tools and Imagemagick
were unable to detect those layers and opened the files as single-layered. Adobe PS opens those layers, but PS is not
available to me. Because of the gradient background, manual cutting is teedious and anulls the point of distributing them.

Sample files can be found at mentioned url, the download button is in upper right, in black, no registration required.
Is it possible to open theese layers in IM and extract the cutout? Thanks...

User avatar
dlemstra
Posts: 1567
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: Multi layered TIFF?

Post by dlemstra » 2014-12-27T06:43:51-07:00

It suspect that Photoshop is 'hiding' the layer information in some part of the metadata. If you help us find documentation about this we might be able to add support for this.
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate

belimlin
Posts: 4
Joined: 2014-12-27T05:27:55-07:00
Authentication code: 6789

Re: Multi layered TIFF?

Post by belimlin » 2014-12-28T11:01:34-07:00

I would be glad to help. I have very little coding skills however, and am not sure how can i contribute.
So far the only clue is the report that multiple apps have been issuing while trying to open the TIFFs:

unknown field with tag 37724 (0x935c) encountered


The file was usually opened afterwards, but flattened to single layer.

I am not sure exactly how to attach files here, if it would help, i can submit one of the TIFFs i have
problems with. With a suggestion on how to help out on the documentation, a quick tip on attaching
files would be handy. Couldn't find it among the FAQ. Thanks...

User avatar
dlemstra
Posts: 1567
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: Multi layered TIFF?

Post by dlemstra » 2014-12-28T11:35:42-07:00

Tiff tag 37724 is used by adobe (http://www.awaresystems.be/imaging/tiff ... edata.html). This is probably where they store the layers. What we need is some kind of document that shows us how to interpret the data. We can do the coding but we need to know how the information is stored. If you can find a document that has that information we can try to add support for reading the layers.

You cannot attach files here, I use dropbox to share files.
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate

snibgo
Posts: 12006
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Multi layered TIFF?

Post by snibgo » 2014-12-28T13:09:12-07:00

The first few bytes of ...

Code: Select all

exiftool -IFD0:ImageSourceData -b xoio_people_sitting_001.tif
... are:

Code: Select all

Adobe Photoshop Document Data Block{00}8BIMLayr{00}8{ee}
(Non-ASCII characters are shown here as hex {00} etc.)

The format seems to be defined at http://www.adobe.com/devnet-apps/photos ... 7409_16000

See also http://partners.adobe.com/public/develo ... toshop.pdf
snibgo's IM pages: im.snibgo.com

User avatar
dlemstra
Posts: 1567
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: Multi layered TIFF?

Post by dlemstra » 2014-12-28T14:34:34-07:00

Can you find the document 'Photoshop TIFF.pdf ' from this part: http://www.adobe.com/devnet-apps/photos ... 7413_48544?
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate

snibgo
Posts: 12006
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Multi layered TIFF?

Post by snibgo » 2014-12-28T14:43:29-07:00

I think it is the second link I gave, http://partners.adobe.com/public/develo ... toshop.pdf

In that document, "page 11 of 13" gives a list of types that can occur: "Layr", "LMsk" etc.
snibgo's IM pages: im.snibgo.com

belimlin
Posts: 4
Joined: 2014-12-27T05:27:55-07:00
Authentication code: 6789

Re: Multi layered TIFF?

Post by belimlin » 2014-12-31T09:45:23-07:00

Hi guys! I have tried to search some more these days, but the smartest i ended up are the files you already located.
I am really not sure what i'm looking for. Hope i didn't ask too much.

Anyways Happy Holydays, and thanks for your software and support. All the best :)

User avatar
dlemstra
Posts: 1567
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: Multi layered TIFF?

Post by dlemstra » 2015-05-25T05:27:55-07:00

I just committed a patch to the TIFF reader, support for reading Photoshop layers in tiff files will be available in ImageMagick 6.9.1-4. I tested this with some of the files you linked and I was able to get an image of a person on a transparent background.
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate

246246
Posts: 190
Joined: 2015-07-06T07:38:22-07:00
Authentication code: 1151

Re: Multi layered TIFF?

Post by 246246 » 2015-07-06T07:52:04-07:00

Using the image above, the layers can be read with ImageMagick 6.9.1-4 to 6.9.1-6, but not with 6.9.1-7.

Code: Select all

>identify -version
Version: ImageMagick 6.9.1--6 Q16 x86 2015-06-20 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2015 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: Cipher DPC HDRI Modules OpenMP
Delegates (built-in): bzlib cairo freetype jng jp2 jpeg lcms lqr openexr pangoca
iro png ps rsvg tiff webp xml zlib

:>identify -format "%[scene]\n" xoio_people_sitting_001.tif
0
1
2

Code: Select all

>identify -version
Version: ImageMagick 6.9.1--7 Q16 x86 2015-07-04 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2015 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: Cipher DPC HDRI Modules OpenMP
Delegates (built-in): bzlib cairo freetype jng jp2 jpeg lcms lqr openexr pangoca
iro png ps rsvg tiff webp xml zlib


>identify -format "%[scene]\n" xoio_people_sitting_001.tif
0

User avatar
dlemstra
Posts: 1567
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: Multi layered TIFF?

Post by dlemstra » 2015-07-06T14:29:12-07:00

We can reproduce the problem you posted and have a patch in ImageMagick 6.9.1-8 Beta, available by sometime tomorrow. Thanks.
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate

246246
Posts: 190
Joined: 2015-07-06T07:38:22-07:00
Authentication code: 1151

Re: Multi layered TIFF?

Post by 246246 » 2015-07-12T21:48:42-07:00

Confirmed to work again with 6.9.1-8. Thank you.

By the way, this change (in 6.9.1-4) causes some problems for backward compatibility. For example,

Code: Select all

$ convert xoio_people_sitting_001.tif xoio_people_sitting_002.tif new.tif
will generate 2 page tiff in 6.9.1-3, whereas newer version generates 6 page tiff.
Or even simple use with

Code: Select all

$ convert -strip xoio_people_sitting_001.tif new2.tif
will generate 3 page tiff.

It is of course a progress that one can get photoshop layer image, but those who concerns only stantard tiff may be confused.

Is it worth considering to introduce new grammar in future to access photoshop tiff layer such as file.tif[0][0], to get first layer of first page?

User avatar
dlemstra
Posts: 1567
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: Multi layered TIFF?

Post by dlemstra » 2015-07-13T03:54:57-07:00

The layers of a tiff image will only be read when the file contains a single page so we won't be needing the new syntax. If you combine tiff files with layers the resulting image will just contain pages. But you are right that instead of 2 pages you will now have 6 pages in your example. Can you prevent this by adding '-define tiff:ignore-layers' to your command.
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate

246246
Posts: 190
Joined: 2015-07-06T07:38:22-07:00
Authentication code: 1151

Re: Multi layered TIFF?

Post by 246246 » 2015-07-13T07:39:40-07:00

dlemstra wrote:The layers of a tiff image will only be read when the file contains a single page so we won't be needing the new syntax.
I see now. It looks Photoshop cannot handle multi page tiff, so in short, currently a tiff file cannot be both multi-layer and multi-page at the same time. (Multi-page tiff can contain tag 37724, but I guess the tag cannot contain layer info of 2nd page, or that info cannot be distinguished to which page it should belong.)
dlemstra wrote:Can you prevent this by adding '-define tiff:ignore-layers' to your command.
Sounds reasonable option. I will try and play with it.

Thank you for good work.

FYI
new.tif created with above command from xoio_people_sitting_001.tif and xoio_people_sitting_002.tif, cannot be read in Photoshop CS6 on Windows. Same thing might happened with viewtopic.php?f=3&t=26799&p=122298.

246246
Posts: 190
Joined: 2015-07-06T07:38:22-07:00
Authentication code: 1151

Re: Multi layered TIFF?

Post by 246246 » 2015-07-13T08:04:36-07:00

246246 wrote: new.tif created with above command from xoio_people_sitting_001.tif and xoio_people_sitting_002.tif, cannot be read in Photoshop CS6 on Windows.
Workaround is to use -strip. (In this case we no more need them as a layer.)

Code: Select all

$ convert -strip xoio_people_sitting_001.tif xoio_people_sitting_002.tif new.tif
As Photoshop only read the 1st page, but no error occurred.

Post Reply