Page 1 of 1

writing multi-image tiff

Posted: 2013-07-16T13:05:19-07:00
by GreenKoopa
Way back at version 6.8.3-0 I could create a tiff containing multiple images and open it in GIMP as layers (or separate images). Using version 6.8.4-8 and up there are several changes. The tiff is significantly fewer bytes. GIMP lists all the images and can open any one, but can't open all at once. Any idea what changed?

For example:
convert -size 500x500 -depth 8 xc:white xc:red gradient:white-black out.tiff

Re: writing multi-image tiff

Posted: 2013-07-16T13:18:04-07:00
by magick
Add -type TrueColor to your command line:
  • convert -size 500x500 -depth 8 xc:white xc:red gradient:white-black -type truecolor out.tiff

Re: writing multi-image tiff

Posted: 2013-07-16T13:35:46-07:00
by snibgo
It fails for me: IM v6.8.6-5, Gimp 2.8.2, on Windows 7.

In Gimp, I can open all the images as separate images. But when I ask to open them as slayers, I get only 2 layers.

When I create my tiff with an extra layer, Gimp can still open only 2.

It worked fine in 6.8.4-0.

Re: writing multi-image tiff

Posted: 2013-07-16T13:40:58-07:00
by GreenKoopa
I am on Windows 7, also using the latest GIMP. Are you seeing the tiff file size change?

Further testing:
I get the same undesirable result using 6.8.4-8, 6.8.5-6, and 6.8.6-3.
Opening as images works. The problem is only with opening as layers.
The more images I add to the file, the more that appear and the more that go missing.

Re: writing multi-image tiff

Posted: 2013-07-16T14:53:50-07:00
by snibgo
When the images are in colour, with +compress, I see almost no difference in file size. Version 6.8.6-5 and 6.8.3-0:

"%IMG6865%convert -size 500x500 -depth 8 xc:pink xc:red gradient:white-blue xc:green +compress out.tiff

"%IMG683%convert" -size 500x500 -depth 8 xc:pink xc:red gradient:white-blue xc:green +compress out3.tiff

Sizes are 3,004,367 and 3,004,368 bytes.

Monochrome images are smaller in the newer IM. Compressed sizes are also smaller. I doubt that this is relevant.

Re: writing multi-image tiff

Posted: 2013-07-16T16:17:41-07:00
by fmw42
When I run this on my Mac with IM 6.8.6.5 Q16

convert -size 500x500 xc:white xc:red gradient:"white-black" -depth 8 out.tiff

IM verbose info show 3 layers. But when I try to open it in my ancient PS CS it only shows the first layer (solid white).

Re: writing multi-image tiff

Posted: 2013-07-16T19:41:44-07:00
by GreenKoopa
snibgo wrote: When the images are in colour, with +compress, I see almost no difference in file size. ... Monochrome images are smaller in the newer IM. Compressed sizes are also smaller. I doubt that this is relevant.
Good observation!

When all of the images are TrueColor (tiff:photometric: RGB), it works properly.
When all of the images are Grayscale (tiff:photometric: min-is-black), it works properly.
Grayscale was saved as TrueColor in older versions.
So -type TrueColor is a work around!

Re: writing multi-image tiff

Posted: 2013-07-16T19:54:35-07:00
by GreenKoopa
At first the unexpected behavior made no sense. All of the images were in the tiff file. IM could see them. GIMP could see them. GIMP could even open them, as long as it was one at a time. So why not all at once? And why does a seemingly random selection of layers get opened while others are silently skipped?

Mixed -type/color modes makes perfect sense. Treated as separate images, there is no need to all match. But as layers, the entire image must be in a single mode. Any layer not matching the color mode of the first is silently skipped by GIMP.

The only time I use tiff is when I want layers in GIMP.

Re: writing multi-image tiff

Posted: 2013-07-16T20:14:47-07:00
by snibgo
Ah, yes, I hadn't taken my tests quite far enough. When the images are all colour (more specifically, the same type), Gimp can open them all as layers.

That's a great tip to know. I could never figure out why I couldn't make a tiff out of both a photo and a greyscale mask and open them together as layers in Gimp. Now I know how. Yippee!

I think we can agree this isn't an IM bug? (I'd say it exposes a problem in Gimp: claiming to open the images as layers, but silently ignoring some.)

Re: writing multi-image tiff

Posted: 2013-07-16T22:27:29-07:00
by GreenKoopa
snibgo wrote: That's a great tip to know. I could never figure out why I couldn't make a tiff out of both a photo and a greyscale mask and open them together as layers in Gimp. Now I know how. Yippee!
I think this used to work for me. This is a change.
snibgo wrote: I think we can agree this isn't an IM bug?
There is nothing in the change log about tiff, so maybe this change was unintentional. In either case, this would be my criteria:
Does IM's output conform to the tiff standard (if there even is a standard)
Does PS write tiff files like IM? GIMP and others will try to support whatever PS outputs.
Will PS read IM's output? If not, it's not standard enough.

If this is a standard-compliant tiff, I don't mind specifying -type TrueColor -depth 8 for use with GIMP. Is there a way for a user to specify -type least_common_denominator? A user only wants TrueColor when at least one image in the sequence requires it. Personally, I don't use tiff often enough to care. I just want a way to save a file with layers for use with GIMP and PS.

Note that tiff:rows-per-strip also changed.

Re: writing multi-image tiff

Posted: 2013-07-16T22:31:14-07:00
by fmw42
My attempts to add -type truecolor to my command above, did not help to import the layers into Photoshop (at least not my very old PS CS).

Re: writing multi-image tiff

Posted: 2013-07-16T22:54:08-07:00
by fmw42
When I run this in IM 6.8.6.5 Q16 Mac OSX

convert -size 500x500 xc:white xc:red gradient:"white-black" -depth 8 -type truecolor out.psd

and open in PS CS it only shows two layers -- the white and the gradient, but not the red

when I run this

convert -size 500x500 xc:white xc:red gradient:"white-black" -depth 8 -type truecolor out.tiff

and open in PS CS it only shows one layer -- the white

Re: writing multi-image tiff

Posted: 2013-07-16T23:02:21-07:00
by snibgo
I used to have problems doing this with Gimp, probably building the layered tiff from different tiff files (with different types).
GreenKoopa wrote:In either case, this would be my criteria: ...
Yes, good points about the standards and "-type least_common_denominator".