TIFF:ignore-layers=true

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
marcos.tonina
Posts: 2
Joined: 2019-04-29T10:27:16-07:00
Authentication code: 1152

TIFF:ignore-layers=true

Post by marcos.tonina »

I try to do the following two commands in Windows and Kubuntu, both with versions 6.9+, and them returns different response in each case:

Code: Select all

convert -define 'tiff:ignore-layers=true' my.tif my.output.tif

Code: Select all

identify -format %[scene] my.output.tif
Second one returns:
Windows: 0
Linux: 0123

Imagemagick version in Windows: 6.9.6-3 Q16
Imagemagick version in Kubuntu: 6.9.7-4 Q16

File: https://www.dropbox.com/s/h0dxbp8wmdq70 ... s.tif?dl=0

Any ideas?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: TIFF:ignore-layers=true

Post by fmw42 »

-format %[scene] is list the scene number for the images in the command sequence, which are your layers. You apparently have 4 layers: 0,1,2,3. Numbering starts at 0. If you want to see the scene numbers separately, use -format "%[scene]\n".

What are you expecting from -define 'tiff:ignore-layers=true'? That ignores the photoshop layers. It is a totally different command from %[scene].
marcos.tonina
Posts: 2
Joined: 2019-04-29T10:27:16-07:00
Authentication code: 1152

Re: TIFF:ignore-layers=true

Post by marcos.tonina »

Well, what I need is to remove layers. I understand -correct me if I am wrong- that tiff:ignore-layers=true removes them, and it is working in Windows and not in Linux.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: TIFF:ignore-layers=true

Post by fmw42 »

What do you mean by "remove layers"? You can just delete them. Or you can flatten them.

Sorry, but I do not know exactly what that define is meant to do
246246
Posts: 190
Joined: 2015-07-06T07:38:22-07:00
Authentication code: 1151

Re: TIFF:ignore-layers=true

Post by 246246 »

Photoshop layers is just a tag 37724 for tiff. (see Photoshop-specific TIFF Tags part at http://paulbourke.net/dataformats/psdps ... 7409_72092 for example.)

When -define tiff:ignore-layers=true is used with identify, it is regarded as just a tag, otherwise (i.e. without -define tiff:ignore-layers=true) it is interpreted as scenes. So it returns info only for 1 scene.

With 6.9.9-40,

Code: Select all

$ identify -quiet -define tiff:ignore-layers=true -format '%[scene]\n' 10212_transparent_with_layers.tif 
0
$ identify -quiet -format '%[scene]\n' 10212_transparent_with_layers.tif 
0
1
2
3
Even if you use it with convert, it does not remove tag. So the result has still 37724 tag, that is regarded as scenes in the 2nd identify command.

However in this case, your file is somewhere broken, at least imagemagick failed to interpret 37724 (or other, maybe 34377) tag.

Code: Select all

% identify -version | head -1
Version: ImageMagick 6.9.9-40 Q16 x86_64 2018-11-24 http://www.imagemagick.org

% identify 10212_transparent_with_layers.tif 
10212_transparent_with_layers.tif TIFF 535x1336 535x1336+0+0 8-bit CMYK 666200B 0.010u 0:00.000
identify: Incompatible type for "RichTIFFIPTC"; tag ignored. `TIFFFetchNormalTag' @ warning/tiff.c/TIFFWarnings/912.
identify: incorrect count for field "DateTimeOriginal" (21, expecting 20); tag trimmed. `0212_transparent_with_layers.tif' @ warning/tiff.c/TIFFWarnings/912.
identify: ASCII value for tag "DateTimeOriginal" does not end in null byte. `TIFFFetchNormalTag' @ warning/tiff.c/TIFFWarnings/912.
identify: Incompatible type for "RichTIFFIPTC"; tag ignored. `TIFFFetchNormalTag' @ warning/tiff.c/TIFFWarnings/912.
identify: improper image header `10212_transparent_with_layers.tif' @ error/psd.c/ReadPSDLayersInternal/1675.
The first 4 lines are warning, you may ignore them, but the last one is error.

Code: Select all

% identify -quiet 10212_transparent_with_layers.tif 
10212_transparent_with_layers.tif TIFF 535x1336 535x1336+0+0 8-bit CMYK 666200B 0.000u 0:00.009
identify: improper image header `10212_transparent_with_layers.tif' @ error/psd.c/ReadPSDLayersInternal/1675.
I don't have the same version with you, but when I first convert the file with -define tiff:ignore-layers=true, it strips the broken part, so the output file is no longer complained by next identify command.

Code: Select all

% convert -quiet -define tiff:ignore-layers=true 10212_transparent_with_layers.tif output.tif
convert: improper image header `10212_transparent_with_layers.tif' @ error/psd.c/ReadPSDLayersInternal/1675.
$ identify output.tif 
output.tif[0] TIFF 535x1336 535x1336+0+0 8-bit CMYK 658720B 0.010u 0:00.000
output.tif[1] TIFF 142x246 142x246+11+230 8-bit CMYK 0.000u 0:00.009
output.tif[2] TIFF 29x213 29x213+17+240 8-bit CMYK 0.000u 0:00.009
output.tif[3] TIFF 37x58 37x58+54+245 8-bit CMYK 0.000u 0:00.009
So I guess your Windows version happen to remove some photoshop related tag.

Anyway I continue to analyze with my version for now.

Here is tiffdump output:

Code: Select all

$ tiffdump 10212_transparent_with_layers.tif 
10212_transparent_with_layers.tif:
Magic: 0x4949 <little-endian> Version: 0x2a <ClassicTIFF>
Directory 0: offset 8 (0x8) next 0 (0)
SubFileType (254) LONG (4) 1<0>
ImageWidth (256) SHORT (3) 1<535>
ImageLength (257) SHORT (3) 1<1336>
BitsPerSample (258) SHORT (3) 5<8 8 8 8 8>
Compression (259) SHORT (3) 1<5>
Photometric (262) SHORT (3) 1<5>
Make (271) ASCII (2) 6<Canon\0>
Model (272) ASCII (2) 14<Canon EOS D30\0>
StripOffsets (273) LONG (4) 14<579580 580452 581324 589228 597226 604286 605158 606030 606902 607774 608646 609518 610390 611262>
Orientation (274) SHORT (3) 1<1>
SamplesPerPixel (277) SHORT (3) 1<5>
RowsPerStrip (278) SHORT (3) 1<97>
StripByteCounts (279) LONG (4) 14<871 871 7903 7998 7060 871 871 871 871 871 871 871 871 762>
XResolution (282) RATIONAL (5) 1<300>
YResolution (283) RATIONAL (5) 1<300>
PlanarConfig (284) SHORT (3) 1<1>
ResolutionUnit (296) SHORT (3) 1<2>
Software (305) ASCII (2) 30<Adobe Photoshop CS6 (Win ...>
DateTime (306) ASCII (2) 20<2017:03:10 08:57:45\0>
Artist (315) ASCII (2) 19<Bernecker + Rainer\0>
Predictor (317) SHORT (3) 1<2>
ExtraSamples (338) SHORT (3) 1<1>
700 (0x2bc) BYTE (1) 17210<0x3c 0x3f 0x78 0x70 0x61 0x63 0x6b 0x65 0x74 0x20 0x62 0x65 0x67 0x69 0x6e 0x3d 0x22 0xef 0xbb 0xbf 0x22 0x20 0x69 0x64 ...>
33723 (0x83bb) UNDEFINED (7) 99<0x1c 0x1 0x5a 00 0x3 0x1b 0x25 0x47 0x1c 0x1 0x5a 00 0x3 0x1b 0x25 0x47 0x1c 0x1 0x5a 00 0x3 0x1b 0x25 0x47 ...>
34377 (0x8649) BYTE (1) 4528<0x38 0x42 0x49 0x4d 0x4 0x25 00 00 00 00 00 0x10 0xf8 0x5d 0x6e 0xb 0x9d 0xad 0xa6 0x95 0x63 0x46 0x42 0x49 ...>
34665 (0x8769) LONG (4) 1<612024>
ICC Profile (34675) UNDEFINED (7) 557164<00 0x8 0x80 0x6c 0x41 0x44 0x42 0x45 0x2 0x10 00 00 0x70 0x72 0x74 0x72 0x43 0x4d 0x59 0x4b 0x4c 0x61 0x62 0x20 ...>
37724 (0x935c) UNDEFINED (7) 53928<0x41 0x64 0x6f 0x62 0x65 0x20 0x50 0x68 0x6f 0x74 0x6f 0x73 0x68 0x6f 0x70 0x20 0x44 0x6f 0x63 0x75 0x6d 0x65 0x6e 0x74 ...>

Code: Select all

$ tiffdump output.tif 
output.tif:
Magic: 0x4949 <little-endian> Version: 0x2a <ClassicTIFF>
Directory 0: offset 25506 (0x63a2) next 0 (0)
ImageWidth (256) SHORT (3) 1<535>
ImageLength (257) SHORT (3) 1<1336>
BitsPerSample (258) SHORT (3) 5<8 8 8 8 8>
Compression (259) SHORT (3) 1<5>
Photometric (262) SHORT (3) 1<5>
FillOrder (266) SHORT (3) 1<1>
StripOffsets (273) LONG (4) 1<8>
Orientation (274) SHORT (3) 1<1>
SamplesPerPixel (277) SHORT (3) 1<5>
RowsPerStrip (278) SHORT (3) 1<1336>
StripByteCounts (279) LONG (4) 1<25498>
XResolution (282) RATIONAL (5) 1<300>
YResolution (283) RATIONAL (5) 1<300>
PlanarConfig (284) SHORT (3) 1<1>
ResolutionUnit (296) SHORT (3) 1<2>
PageNumber (297) SHORT (3) 2<0 1>
Whitepoint (318) RATIONAL (5) 2<0.3127 0.329>
PrimaryChromaticities (319) RATIONAL (5) 6<0.64 0.33 0.3 0.6 0.15 0.06>
InkSet (332) SHORT (3) 1<1>
ExtraSamples (338) SHORT (3) 1<2>
700 (0x2bc) BYTE (1) 17210<0x3c 0x3f 0x78 0x70 0x61 0x63 0x6b 0x65 0x74 0x20 0x62 0x65 0x67 0x69 0x6e 0x3d 0x22 0xef 0xbb 0xbf 0x22 0x20 0x69 0x64 ...>
34377 (0x8649) BYTE (1) 4528<0x38 0x42 0x49 0x4d 0x4 0x25 00 00 00 00 00 0x10 0xf8 0x5d 0x6e 0xb 0x9d 0xad 0xa6 0x95 0x63 0x46 0x42 0x49 ...>
ICC Profile (34675) UNDEFINED (7) 557164<00 0x8 0x80 0x6c 0x41 0x44 0x42 0x45 0x2 0x10 00 00 0x70 0x72 0x74 0x72 0x43 0x4d 0x59 0x4b 0x4c 0x61 0x62 0x20 ...>
37724 (0x935c) UNDEFINED (7) 53928<0x41 0x64 0x6f 0x62 0x65 0x20 0x50 0x68 0x6f 0x74 0x6f 0x73 0x68 0x6f 0x70 0x20 0x44 0x6f 0x63 0x75 0x6d 0x65 0x6e 0x74 ...>
Null terminated tags are removed.

But, something seems to be odd. It does not change the 34377 and 37724 tag, at least for the length. Why only the original image (10212_transparent_with_layers.tif) has error?

I try to remove those tags to remove photoshop layer:

Code: Select all

% convert output.tif +profile "34377,37724" output2.tif 
% tiffdump output2.tif 
output2.tif:
Magic: 0x4949 <little-endian> Version: 0x2a <ClassicTIFF>
Directory 0: offset 25506 (0x63a2) next 671614 (0xa3f7e)
SubFileType (254) LONG (4) 1<2>
ImageWidth (256) SHORT (3) 1<535>
ImageLength (257) SHORT (3) 1<1336>
BitsPerSample (258) SHORT (3) 5<8 8 8 8 8>
Compression (259) SHORT (3) 1<5>
Photometric (262) SHORT (3) 1<5>
FillOrder (266) SHORT (3) 1<1>
StripOffsets (273) LONG (4) 1<8>
Orientation (274) SHORT (3) 1<1>
SamplesPerPixel (277) SHORT (3) 1<5>
RowsPerStrip (278) SHORT (3) 1<1336>
StripByteCounts (279) LONG (4) 1<25498>
XResolution (282) RATIONAL (5) 1<300>
YResolution (283) RATIONAL (5) 1<300>
PlanarConfig (284) SHORT (3) 1<1>
ResolutionUnit (296) SHORT (3) 1<2>
PageNumber (297) SHORT (3) 2<0 4>
Whitepoint (318) RATIONAL (5) 2<0.3127 0.329>
PrimaryChromaticities (319) RATIONAL (5) 6<0.64 0.33 0.3 0.6 0.15 0.06>
InkSet (332) SHORT (3) 1<1>
ExtraSamples (338) SHORT (3) 1<2>
700 (0x2bc) BYTE (1) 17210<0x3c 0x3f 0x78 0x70 0x61 0x63 0x6b 0x65 0x74 0x20 0x62 0x65 0x67 0x69 0x6e 0x3d 0x22 0xef 0xbb 0xbf 0x22 0x20 0x69 0x64 ...>
34377 (0x8649) BYTE (1) 4528<0x38 0x42 0x49 0x4d 0x4 0x25 00 00 00 00 00 0x10 0xf8 0x5d 0x6e 0xb 0x9d 0xad 0xa6 0x95 0x63 0x46 0x42 0x49 ...>
ICC Profile (34675) UNDEFINED (7) 557164<00 0x8 0x80 0x6c 0x41 0x44 0x42 0x45 0x2 0x10 00 00 0x70 0x72 0x74 0x72 0x43 0x4d 0x59 0x4b 0x4c 0x61 0x62 0x20 ...>
37724 (0x935c) UNDEFINED (7) 53928<0x41 0x64 0x6f 0x62 0x65 0x20 0x50 0x68 0x6f 0x74 0x6f 0x73 0x68 0x6f 0x70 0x20 0x44 0x6f 0x63 0x75 0x6d 0x65 0x6e 0x74 ...>

Directory 1: offset 671614 (0xa3f7e) next 1253086 (0x131ede)
SubFileType (254) LONG (4) 1<2>
ImageWidth (256) SHORT (3) 1<142>
ImageLength (257) SHORT (3) 1<246>
BitsPerSample (258) SHORT (3) 5<8 8 8 8 8>
Compression (259) SHORT (3) 1<5>
Photometric (262) SHORT (3) 1<5>
FillOrder (266) SHORT (3) 1<1>
StripOffsets (273) LONG (4) 1<658732>
Orientation (274) SHORT (3) 1<1>
SamplesPerPixel (277) SHORT (3) 1<5>
RowsPerStrip (278) SHORT (3) 1<246>
StripByteCounts (279) LONG (4) 1<12881>
XResolution (282) RATIONAL (5) 1<300>
YResolution (283) RATIONAL (5) 1<300>
PlanarConfig (284) SHORT (3) 1<1>
PageName (285) ASCII (2) 8<Ebene 1\0>
XPosition (286) RATIONAL (5) 1<0.0366667>
YPosition (287) RATIONAL (5) 1<0.766667>
ResolutionUnit (296) SHORT (3) 1<2>
PageNumber (297) SHORT (3) 2<1 4>
Whitepoint (318) RATIONAL (5) 2<0.3127 0.329>
PrimaryChromaticities (319) RATIONAL (5) 6<0.64 0.33 0.3 0.6 0.15 0.06>
InkSet (332) SHORT (3) 1<1>
ExtraSamples (338) SHORT (3) 1<2>
700 (0x2bc) BYTE (1) 17210<0x3c 0x3f 0x78 0x70 0x61 0x63 0x6b 0x65 0x74 0x20 0x62 0x65 0x67 0x69 0x6e 0x3d 0x22 0xef 0xbb 0xbf 0x22 0x20 0x69 0x64 ...>
34377 (0x8649) BYTE (1) 4528<0x38 0x42 0x49 0x4d 0x4 0x25 00 00 00 00 00 0x10 0xf8 0x5d 0x6e 0xb 0x9d 0xad 0xa6 0x95 0x63 0x46 0x42 0x49 ...>
ICC Profile (34675) UNDEFINED (7) 557164<00 0x8 0x80 0x6c 0x41 0x44 0x42 0x45 0x2 0x10 00 00 0x70 0x72 0x74 0x72 0x43 0x4d 0x59 0x4b 0x4c 0x61 0x62 0x20 ...>

Directory 2: offset 1253086 (0x131ede) next 1833374 (0x1bf99e)
SubFileType (254) LONG (4) 1<2>
ImageWidth (256) SHORT (3) 1<29>
ImageLength (257) SHORT (3) 1<213>
BitsPerSample (258) SHORT (3) 5<8 8 8 8 8>
Compression (259) SHORT (3) 1<5>
Photometric (262) SHORT (3) 1<5>
FillOrder (266) SHORT (3) 1<1>
StripOffsets (273) LONG (4) 1<1250960>
Orientation (274) SHORT (3) 1<1>
SamplesPerPixel (277) SHORT (3) 1<5>
RowsPerStrip (278) SHORT (3) 1<213>
StripByteCounts (279) LONG (4) 1<2125>
XResolution (282) RATIONAL (5) 1<300>
YResolution (283) RATIONAL (5) 1<300>
PlanarConfig (284) SHORT (3) 1<1>
PageName (285) ASCII (2) 12<X20 BR 7300\0>
XPosition (286) RATIONAL (5) 1<0.0566667>
YPosition (287) RATIONAL (5) 1<0.8>
ResolutionUnit (296) SHORT (3) 1<2>
PageNumber (297) SHORT (3) 2<2 4>
Whitepoint (318) RATIONAL (5) 2<0.3127 0.329>
PrimaryChromaticities (319) RATIONAL (5) 6<0.64 0.33 0.3 0.6 0.15 0.06>
InkSet (332) SHORT (3) 1<1>
ExtraSamples (338) SHORT (3) 1<2>
700 (0x2bc) BYTE (1) 17210<0x3c 0x3f 0x78 0x70 0x61 0x63 0x6b 0x65 0x74 0x20 0x62 0x65 0x67 0x69 0x6e 0x3d 0x22 0xef 0xbb 0xbf 0x22 0x20 0x69 0x64 ...>
34377 (0x8649) BYTE (1) 4528<0x38 0x42 0x49 0x4d 0x4 0x25 00 00 00 00 00 0x10 0xf8 0x5d 0x6e 0xb 0x9d 0xad 0xa6 0x95 0x63 0x46 0x42 0x49 ...>
ICC Profile (34675) UNDEFINED (7) 557164<00 0x8 0x80 0x6c 0x41 0x44 0x42 0x45 0x2 0x10 00 00 0x70 0x72 0x74 0x72 0x43 0x4d 0x59 0x4b 0x4c 0x61 0x62 0x20 ...>

Directory 3: offset 1833374 (0x1bf99e) next 0 (0)
SubFileType (254) LONG (4) 1<2>
ImageWidth (256) SHORT (3) 1<37>
ImageLength (257) SHORT (3) 1<58>
BitsPerSample (258) SHORT (3) 5<8 8 8 8 8>
Compression (259) SHORT (3) 1<5>
Photometric (262) SHORT (3) 1<5>
FillOrder (266) SHORT (3) 1<1>
StripOffsets (273) LONG (4) 1<1832436>
Orientation (274) SHORT (3) 1<1>
SamplesPerPixel (277) SHORT (3) 1<5>
RowsPerStrip (278) SHORT (3) 1<58>
StripByteCounts (279) LONG (4) 1<938>
XResolution (282) RATIONAL (5) 1<300>
YResolution (283) RATIONAL (5) 1<300>
PlanarConfig (284) SHORT (3) 1<1>
PageName (285) ASCII (2) 8<ST Tx  \0>
XPosition (286) RATIONAL (5) 1<0.18>
YPosition (287) RATIONAL (5) 1<0.816667>
ResolutionUnit (296) SHORT (3) 1<2>
PageNumber (297) SHORT (3) 2<3 4>
Whitepoint (318) RATIONAL (5) 2<0.3127 0.329>
PrimaryChromaticities (319) RATIONAL (5) 6<0.64 0.33 0.3 0.6 0.15 0.06>
InkSet (332) SHORT (3) 1<1>
ExtraSamples (338) SHORT (3) 1<2>
700 (0x2bc) BYTE (1) 17210<0x3c 0x3f 0x78 0x70 0x61 0x63 0x6b 0x65 0x74 0x20 0x62 0x65 0x67 0x69 0x6e 0x3d 0x22 0xef 0xbb 0xbf 0x22 0x20 0x69 0x64 ...>
34377 (0x8649) BYTE (1) 4528<0x38 0x42 0x49 0x4d 0x4 0x25 00 00 00 00 00 0x10 0xf8 0x5d 0x6e 0xb 0x9d 0xad 0xa6 0x95 0x63 0x46 0x42 0x49 ...>
ICC Profile (34675) UNDEFINED (7) 557164<00 0x8 0x80 0x6c 0x41 0x44 0x42 0x45 0x2 0x10 00 00 0x70 0x72 0x74 0x72 0x43 0x4d 0x59 0x4b 0x4c 0x61 0x62 0x20 ...>
It does not strip 34377 tag, furthermore, the file turned into multi-page (not layer) tiff. Even with -strip

Code: Select all

$ convert output.tif -strip output3.tif 
$ tiffdump output3.tif 
output3.tif:
Magic: 0x4949 <little-endian> Version: 0x2a <ClassicTIFF>
Directory 0: offset 25506 (0x63a2) next 38736 (0x9750)
SubFileType (254) LONG (4) 1<2>
ImageWidth (256) SHORT (3) 1<535>
ImageLength (257) SHORT (3) 1<1336>
BitsPerSample (258) SHORT (3) 5<8 8 8 8 8>
Compression (259) SHORT (3) 1<5>
Photometric (262) SHORT (3) 1<5>
FillOrder (266) SHORT (3) 1<1>
StripOffsets (273) LONG (4) 1<8>
Orientation (274) SHORT (3) 1<1>
SamplesPerPixel (277) SHORT (3) 1<5>
RowsPerStrip (278) SHORT (3) 1<1336>
StripByteCounts (279) LONG (4) 1<25498>
XResolution (282) RATIONAL (5) 1<300>
YResolution (283) RATIONAL (5) 1<300>
PlanarConfig (284) SHORT (3) 1<1>
ResolutionUnit (296) SHORT (3) 1<2>
PageNumber (297) SHORT (3) 2<0 4>
Whitepoint (318) RATIONAL (5) 2<0.3127 0.329>
PrimaryChromaticities (319) RATIONAL (5) 6<0.64 0.33 0.3 0.6 0.15 0.06>
InkSet (332) SHORT (3) 1<1>
ExtraSamples (338) SHORT (3) 1<2>

Directory 1: offset 38736 (0x9750) next 41270 (0xa136)
SubFileType (254) LONG (4) 1<2>
ImageWidth (256) SHORT (3) 1<142>
ImageLength (257) SHORT (3) 1<246>
BitsPerSample (258) SHORT (3) 5<8 8 8 8 8>
Compression (259) SHORT (3) 1<5>
Photometric (262) SHORT (3) 1<5>
FillOrder (266) SHORT (3) 1<1>
StripOffsets (273) LONG (4) 1<25854>
Orientation (274) SHORT (3) 1<1>
SamplesPerPixel (277) SHORT (3) 1<5>
RowsPerStrip (278) SHORT (3) 1<246>
StripByteCounts (279) LONG (4) 1<12881>
XResolution (282) RATIONAL (5) 1<300>
YResolution (283) RATIONAL (5) 1<300>
PlanarConfig (284) SHORT (3) 1<1>
PageName (285) ASCII (2) 8<Ebene 1\0>
XPosition (286) RATIONAL (5) 1<0.0366667>
YPosition (287) RATIONAL (5) 1<0.766667>
ResolutionUnit (296) SHORT (3) 1<2>
PageNumber (297) SHORT (3) 2<1 4>
Whitepoint (318) RATIONAL (5) 2<0.3127 0.329>
PrimaryChromaticities (319) RATIONAL (5) 6<0.64 0.33 0.3 0.6 0.15 0.06>
InkSet (332) SHORT (3) 1<1>
ExtraSamples (338) SHORT (3) 1<2>

Directory 2: offset 41270 (0xa136) next 42620 (0xa67c)
SubFileType (254) LONG (4) 1<2>
ImageWidth (256) SHORT (3) 1<29>
ImageLength (257) SHORT (3) 1<213>
BitsPerSample (258) SHORT (3) 5<8 8 8 8 8>
Compression (259) SHORT (3) 1<5>
Photometric (262) SHORT (3) 1<5>
FillOrder (266) SHORT (3) 1<1>
StripOffsets (273) LONG (4) 1<39144>
Orientation (274) SHORT (3) 1<1>
SamplesPerPixel (277) SHORT (3) 1<5>
RowsPerStrip (278) SHORT (3) 1<213>
StripByteCounts (279) LONG (4) 1<2125>
XResolution (282) RATIONAL (5) 1<300>
YResolution (283) RATIONAL (5) 1<300>
PlanarConfig (284) SHORT (3) 1<1>
PageName (285) ASCII (2) 12<X20 BR 7300\0>
XPosition (286) RATIONAL (5) 1<0.0566667>
YPosition (287) RATIONAL (5) 1<0.8>
ResolutionUnit (296) SHORT (3) 1<2>
PageNumber (297) SHORT (3) 2<2 4>
Whitepoint (318) RATIONAL (5) 2<0.3127 0.329>
PrimaryChromaticities (319) RATIONAL (5) 6<0.64 0.33 0.3 0.6 0.15 0.06>
InkSet (332) SHORT (3) 1<1>
ExtraSamples (338) SHORT (3) 1<2>

Directory 3: offset 42620 (0xa67c) next 0 (0)
SubFileType (254) LONG (4) 1<2>
ImageWidth (256) SHORT (3) 1<37>
ImageLength (257) SHORT (3) 1<58>
BitsPerSample (258) SHORT (3) 5<8 8 8 8 8>
Compression (259) SHORT (3) 1<5>
Photometric (262) SHORT (3) 1<5>
FillOrder (266) SHORT (3) 1<1>
StripOffsets (273) LONG (4) 1<41682>
Orientation (274) SHORT (3) 1<1>
SamplesPerPixel (277) SHORT (3) 1<5>
RowsPerStrip (278) SHORT (3) 1<58>
StripByteCounts (279) LONG (4) 1<938>
XResolution (282) RATIONAL (5) 1<300>
YResolution (283) RATIONAL (5) 1<300>
PlanarConfig (284) SHORT (3) 1<1>
PageName (285) ASCII (2) 8<ST Tx  \0>
XPosition (286) RATIONAL (5) 1<0.18>
YPosition (287) RATIONAL (5) 1<0.816667>
ResolutionUnit (296) SHORT (3) 1<2>
PageNumber (297) SHORT (3) 2<3 4>
Whitepoint (318) RATIONAL (5) 2<0.3127 0.329>
PrimaryChromaticities (319) RATIONAL (5) 6<0.64 0.33 0.3 0.6 0.15 0.06>
InkSet (332) SHORT (3) 1<1>
ExtraSamples (338) SHORT (3) 1<2>

Code: Select all

$ identify -define tiff:ignore-layers=true output2.tif 
output2.tif[0] TIFF 535x1336 535x1336+0+0 8-bit CMYK 2412720B 0.000u 0:00.000
output2.tif[1] TIFF 142x246 142x246+11+230 8-bit CMYK 2412720B 0.000u 0:00.000
output2.tif[2] TIFF 29x213 29x213+17+240 8-bit CMYK 2412720B 0.000u 0:00.009
output2.tif[3] TIFF 37x58 37x58+54+245 8-bit CMYK 2412720B 0.000u 0:00.009

$ identify -define tiff:ignore-layers=true output3.tif 
output3.tif[0] TIFF 535x1336 535x1336+0+0 8-bit CMYK 43028B 0.000u 0:00.000
output3.tif[1] TIFF 142x246 142x246+11+230 8-bit CMYK 43028B 0.000u 0:00.000
output3.tif[2] TIFF 29x213 29x213+17+240 8-bit CMYK 43028B 0.000u 0:00.000
output3.tif[3] TIFF 37x58 37x58+54+245 8-bit CMYK 43028B 0.000u 0:00.000
So I think it is a bug in +profile and in -strip.

Using tiffset command, these tags can be removed.

Code: Select all

$ cp output.tif output4.tif
$ tiffset -u 34377 output4.tif 
TIFFReadDirectory: Warning, Unknown field with tag 37724 (0x935c) encountered.
$ tiffset -u 37724 output4.tif 
TIFFReadDirectory: Warning, Unknown field with tag 37724 (0x935c) encountered.
$ identify -define tiff:ignore-layers=true output4.tif 
output4.tif TIFF 535x1336 535x1336+0+0 8-bit CMYK 1.77586MiB 0.010u 0:00.000

---
Edit:

Something is really odd.
If I specify the file at the current directory, identify does not output error, however it is specified as relative or absolute path, it output error.

Code: Select all

$ identify -quiet tmp6/10212_transparent_with_layers.tif 
tmp6/10212_transparent_with_layers.tif TIFF 535x1336 535x1336+0+0 8-bit CMYK 666200B 0.000u 0:00.019
identify: improper image header `tmp6/10212_transparent_with_layers.tif' @ error/psd.c/ReadPSDLayersInternal/1675.
$ cd tmp6
$ identify -quiet ./10212_transparent_with_layers.tif 
./10212_transparent_with_layers.tif[0] TIFF 535x1336 535x1336+0+0 8-bit CMYK 666200B 0.010u 0:00.009
./10212_transparent_with_layers.tif[1] TIFF 142x246 142x246+11+230 8-bit CMYK 0.000u 0:00.000
./10212_transparent_with_layers.tif[2] TIFF 29x213 29x213+17+240 8-bit CMYK 0.000u 0:00.000
./10212_transparent_with_layers.tif[3] TIFF 37x58 37x58+54+245 8-bit CMYK 0.000u 0:00.000
So the analyze above might be totally wrong.
Here is the version again. It comes from macport.

Code: Select all

% convert -version
Version: ImageMagick 6.9.9-40 Q16 x86_64 2018-11-24 http://www.imagemagick.org
Copyright: © 1999-2018 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: Cipher DPC Modules 
Delegates (built-in): bzlib cairo djvu fftw fontconfig freetype gslib gvc jbig jng jp2 jpeg lcms lqr ltdl lzma openexr pangocairo png ps raw rsvg tiff webp wmf x xml zlib
Last edited by 246246 on 2019-05-01T07:49:26-07:00, edited 7 times in total.
246246
Posts: 190
Joined: 2015-07-06T07:38:22-07:00
Authentication code: 1151

Re: TIFF:ignore-layers=true

Post by 246246 »

246246 wrote: 2019-04-30T18:15:49-07:00 Here is tiffdump output:

Code: Select all

$ tiffdump 10212_transparent_with_layers.tif 
10212_transparent_with_layers.tif:
Magic: 0x4949 <little-endian> Version: 0x2a <ClassicTIFF>
Directory 0: offset 8 (0x8) next 0 (0)
SubFileType (254) LONG (4) 1<0>
ImageWidth (256) SHORT (3) 1<535>
ImageLength (257) SHORT (3) 1<1336>
BitsPerSample (258) SHORT (3) 5<8 8 8 8 8>
Compression (259) SHORT (3) 1<5>
Photometric (262) SHORT (3) 1<5>
Make (271) ASCII (2) 6<Canon\0>
Model (272) ASCII (2) 14<Canon EOS D30\0>
StripOffsets (273) LONG (4) 14<579580 580452 581324 589228 597226 604286 605158 606030 606902 607774 608646 609518 610390 611262>
Orientation (274) SHORT (3) 1<1>
SamplesPerPixel (277) SHORT (3) 1<5>
RowsPerStrip (278) SHORT (3) 1<97>
StripByteCounts (279) LONG (4) 14<871 871 7903 7998 7060 871 871 871 871 871 871 871 871 762>
XResolution (282) RATIONAL (5) 1<300>
YResolution (283) RATIONAL (5) 1<300>
PlanarConfig (284) SHORT (3) 1<1>
ResolutionUnit (296) SHORT (3) 1<2>
Software (305) ASCII (2) 30<Adobe Photoshop CS6 (Win ...>
DateTime (306) ASCII (2) 20<2017:03:10 08:57:45\0>
Artist (315) ASCII (2) 19<Bernecker + Rainer\0>
Predictor (317) SHORT (3) 1<2>
ExtraSamples (338) SHORT (3) 1<1>
700 (0x2bc) BYTE (1) 17210<0x3c 0x3f 0x78 0x70 0x61 0x63 0x6b 0x65 0x74 0x20 0x62 0x65 0x67 0x69 0x6e 0x3d 0x22 0xef 0xbb 0xbf 0x22 0x20 0x69 0x64 ...>
33723 (0x83bb) UNDEFINED (7) 99<0x1c 0x1 0x5a 00 0x3 0x1b 0x25 0x47 0x1c 0x1 0x5a 00 0x3 0x1b 0x25 0x47 0x1c 0x1 0x5a 00 0x3 0x1b 0x25 0x47 ...>
34377 (0x8649) BYTE (1) 4528<0x38 0x42 0x49 0x4d 0x4 0x25 00 00 00 00 00 0x10 0xf8 0x5d 0x6e 0xb 0x9d 0xad 0xa6 0x95 0x63 0x46 0x42 0x49 ...>
34665 (0x8769) LONG (4) 1<612024>
ICC Profile (34675) UNDEFINED (7) 557164<00 0x8 0x80 0x6c 0x41 0x44 0x42 0x45 0x2 0x10 00 00 0x70 0x72 0x74 0x72 0x43 0x4d 0x59 0x4b 0x4c 0x61 0x62 0x20 ...>
37724 (0x935c) UNDEFINED (7) 53928<0x41 0x64 0x6f 0x62 0x65 0x20 0x50 0x68 0x6f 0x74 0x6f 0x73 0x68 0x6f 0x70 0x20 0x44 0x6f 0x63 0x75 0x6d 0x65 0x6e 0x74 ...>

Code: Select all

$ tiffdump output.tif 
output.tif:
Magic: 0x4949 <little-endian> Version: 0x2a <ClassicTIFF>
Directory 0: offset 25506 (0x63a2) next 0 (0)
ImageWidth (256) SHORT (3) 1<535>
ImageLength (257) SHORT (3) 1<1336>
BitsPerSample (258) SHORT (3) 5<8 8 8 8 8>
Compression (259) SHORT (3) 1<5>
Photometric (262) SHORT (3) 1<5>
FillOrder (266) SHORT (3) 1<1>
StripOffsets (273) LONG (4) 1<8>
Orientation (274) SHORT (3) 1<1>
SamplesPerPixel (277) SHORT (3) 1<5>
RowsPerStrip (278) SHORT (3) 1<1336>
StripByteCounts (279) LONG (4) 1<25498>
XResolution (282) RATIONAL (5) 1<300>
YResolution (283) RATIONAL (5) 1<300>
PlanarConfig (284) SHORT (3) 1<1>
ResolutionUnit (296) SHORT (3) 1<2>
PageNumber (297) SHORT (3) 2<0 1>
Whitepoint (318) RATIONAL (5) 2<0.3127 0.329>
PrimaryChromaticities (319) RATIONAL (5) 6<0.64 0.33 0.3 0.6 0.15 0.06>
InkSet (332) SHORT (3) 1<1>
ExtraSamples (338) SHORT (3) 1<2>
700 (0x2bc) BYTE (1) 17210<0x3c 0x3f 0x78 0x70 0x61 0x63 0x6b 0x65 0x74 0x20 0x62 0x65 0x67 0x69 0x6e 0x3d 0x22 0xef 0xbb 0xbf 0x22 0x20 0x69 0x64 ...>
34377 (0x8649) BYTE (1) 4528<0x38 0x42 0x49 0x4d 0x4 0x25 00 00 00 00 00 0x10 0xf8 0x5d 0x6e 0xb 0x9d 0xad 0xa6 0x95 0x63 0x46 0x42 0x49 ...>
ICC Profile (34675) UNDEFINED (7) 557164<00 0x8 0x80 0x6c 0x41 0x44 0x42 0x45 0x2 0x10 00 00 0x70 0x72 0x74 0x72 0x43 0x4d 0x59 0x4b 0x4c 0x61 0x62 0x20 ...>
37724 (0x935c) UNDEFINED (7) 53928<0x41 0x64 0x6f 0x62 0x65 0x20 0x50 0x68 0x6f 0x74 0x6f 0x73 0x68 0x6f 0x70 0x20 0x44 0x6f 0x63 0x75 0x6d 0x65 0x6e 0x74 ...>
Null terminated tags are removed.

But, something seems to be odd. It does not change the 34377 and 37724 tag, at least for the length. Why only the original image (10212_transparent_with_layers.tif) has error?
It looks 34665 is removed here, that is Exif.
If you'ed like to keep it, you could apply tiffset -u for the original file. (It still contains null terminated ASCII tag though.)
246246
Posts: 190
Joined: 2015-07-06T07:38:22-07:00
Authentication code: 1151

Re: TIFF:ignore-layers=true

Post by 246246 »

246246 wrote: 2019-04-30T18:15:49-07:00 So I think it is a bug in +profile and in -strip.
Oh, I see. Here I have to add -define tiff:ignore-layers=true

Code: Select all

$ convert -quiet -define tiff:ignore-layers=true 10212_transparent_with_layers.tif +profile "34377,37724" out.tif
$ tiffdump out.tif 
out.tif:
Magic: 0x4949 <little-endian> Version: 0x2a <ClassicTIFF>
Directory 0: offset 25506 (0x63a2) next 0 (0)
ImageWidth (256) SHORT (3) 1<535>
ImageLength (257) SHORT (3) 1<1336>
BitsPerSample (258) SHORT (3) 5<8 8 8 8 8>
Compression (259) SHORT (3) 1<5>
Photometric (262) SHORT (3) 1<5>
FillOrder (266) SHORT (3) 1<1>
StripOffsets (273) LONG (4) 1<8>
Orientation (274) SHORT (3) 1<1>
SamplesPerPixel (277) SHORT (3) 1<5>
RowsPerStrip (278) SHORT (3) 1<1336>
StripByteCounts (279) LONG (4) 1<25498>
XResolution (282) RATIONAL (5) 1<300>
YResolution (283) RATIONAL (5) 1<300>
PlanarConfig (284) SHORT (3) 1<1>
ResolutionUnit (296) SHORT (3) 1<2>
PageNumber (297) SHORT (3) 2<0 1>
Whitepoint (318) RATIONAL (5) 2<0.3127 0.329>
PrimaryChromaticities (319) RATIONAL (5) 6<0.64 0.33 0.3 0.6 0.15 0.06>
InkSet (332) SHORT (3) 1<1>
ExtraSamples (338) SHORT (3) 1<2>
700 (0x2bc) BYTE (1) 17210<0x3c 0x3f 0x78 0x70 0x61 0x63 0x6b 0x65 0x74 0x20 0x62 0x65 0x67 0x69 0x6e 0x3d 0x22 0xef 0xbb 0xbf 0x22 0x20 0x69 0x64 ...>
34377 (0x8649) BYTE (1) 4528<0x38 0x42 0x49 0x4d 0x4 0x25 00 00 00 00 00 0x10 0xf8 0x5d 0x6e 0xb 0x9d 0xad 0xa6 0x95 0x63 0x46 0x42 0x49 ...>
ICC Profile (34675) UNDEFINED (7) 557164<00 0x8 0x80 0x6c 0x41 0x44 0x42 0x45 0x2 0x10 00 00 0x70 0x72 0x74 0x72 0x43 0x4d 0x59 0x4b 0x4c 0x61 0x62 0x20 ...>
37724 (0x935c) UNDEFINED (7) 53928<0x41 0x64 0x6f 0x62 0x65 0x20 0x50 0x68 0x6f 0x74 0x6f 0x73 0x68 0x6f 0x70 0x20 0x44 0x6f 0x63 0x75 0x6d 0x65 0x6e 0x74 ...>
However, these tags are not stripped...

With version 7:

Code: Select all

$ magick -version | head -1
Version: ImageMagick 7.0.8-42 Q16 x86_64 2019-04-24 https://imagemagick.org
$ magick convert -quiet -define tiff:ignore-layers=true 10212_transparent_with_layers.tif +profile "34377,37724" out2.tif
$ tiffdump out2.tif 
out2.tif:
Magic: 0x4949 <little-endian> Version: 0x2a <ClassicTIFF>
Directory 0: offset 26172 (0x663c) next 0 (0)
ImageWidth (256) SHORT (3) 1<535>
ImageLength (257) SHORT (3) 1<1336>
BitsPerSample (258) SHORT (3) 5<8 8 8 8 8>
Compression (259) SHORT (3) 1<5>
Photometric (262) SHORT (3) 1<5>
FillOrder (266) SHORT (3) 1<1>
StripOffsets (273) LONG (4) 1<8>
Orientation (274) SHORT (3) 1<1>
SamplesPerPixel (277) SHORT (3) 1<5>
RowsPerStrip (278) SHORT (3) 1<1336>
StripByteCounts (279) LONG (4) 1<26163>
XResolution (282) RATIONAL (5) 1<300>
YResolution (283) RATIONAL (5) 1<300>
PlanarConfig (284) SHORT (3) 1<1>
ResolutionUnit (296) SHORT (3) 1<2>
PageNumber (297) SHORT (3) 2<0 1>
Predictor (317) SHORT (3) 1<2>
Whitepoint (318) RATIONAL (5) 2<0.3127 0.329>
PrimaryChromaticities (319) RATIONAL (5) 6<0.64 0.33 0.3 0.6 0.15 0.06>
InkSet (332) SHORT (3) 1<1>
ExtraSamples (338) SHORT (3) 1<2>
700 (0x2bc) BYTE (1) 17210<0x3c 0x3f 0x78 0x70 0x61 0x63 0x6b 0x65 0x74 0x20 0x62 0x65 0x67 0x69 0x6e 0x3d 0x22 0xef 0xbb 0xbf 0x22 0x20 0x69 0x64 ...>
34377 (0x8649) BYTE (1) 4528<0x38 0x42 0x49 0x4d 0x4 0x25 00 00 00 00 00 0x10 0xf8 0x5d 0x6e 0xb 0x9d 0xad 0xa6 0x95 0x63 0x46 0x42 0x49 ...>
ICC Profile (34675) UNDEFINED (7) 557164<00 0x8 0x80 0x6c 0x41 0x44 0x42 0x45 0x2 0x10 00 00 0x70 0x72 0x74 0x72 0x43 0x4d 0x59 0x4b 0x4c 0x61 0x62 0x20 ...>
Tag 37724 is removed, but 34377 is still there.

As a result, when I tried to get the only layer[0],

Code: Select all

$ convert -quiet -define tiff:ignore-layers=true 10212_transparent_with_layers.tif[0] out0-v6.tif
$ magick convert -quiet -define tiff:ignore-layers=true 10212_transparent_with_layers.tif[0] out0-v7.tif
$ magick identify -define tiff:ignore-layers=true out0-v6.tif out0-v7.tif 
out0-v6.tif TIFF 535x1336 535x1336+0+0 8-bit CMYK 658720B 0.000u 0:00.003
out0-v7.tif TIFF 535x1336 535x1336+0+0 8-bit CMYK 605458B 0.000u 0:00.000
$ magick identify out0-v6.tif out0-v7.tif 
out0-v6.tif[0] TIFF 535x1336 535x1336+0+0 8-bit CMYK 658720B 0.000u 0:00.006
out0-v6.tif[1] TIFF 142x246 142x246+11+230 8-bit CMYK 658720B 0.000u 0:00.001
out0-v6.tif[2] TIFF 29x213 29x213+17+240 8-bit CMYK 658720B 0.000u 0:00.000
out0-v6.tif[3] TIFF 37x58 37x58+54+245 8-bit CMYK 658720B 0.000u 0:00.000
out0-v7.tif TIFF 535x1336 535x1336+0+0 8-bit CMYK 605458B 0.000u 0:00.001
v6 still contains layer. Even without -define tiff:ignore-layers=true at convert:

Code: Select all

$ convert -quiet 10212_transparent_with_layers.tif[0] out0-v6.tif
$ identify -define tiff:ignore-layers=true out0-v6.tif 
out0-v6.tif TIFF 535x1336 535x1336+0+0 8-bit CMYK 658720B 0.010u 0:00.009
$ identify out0-v6.tif 
out0-v6.tif[0] TIFF 535x1336 535x1336+0+0 8-bit CMYK 658720B 0.010u 0:00.009
out0-v6.tif[1] TIFF 142x246 142x246+11+230 8-bit CMYK 0.000u 0:00.009
out0-v6.tif[2] TIFF 29x213 29x213+17+240 8-bit CMYK 0.000u 0:00.009
out0-v6.tif[3] TIFF 37x58 37x58+54+245 8-bit CMYK 0.000u 0:00.000
Last edited by 246246 on 2019-04-30T21:26:02-07:00, edited 1 time in total.
246246
Posts: 190
Joined: 2015-07-06T07:38:22-07:00
Authentication code: 1151

Re: TIFF:ignore-layers=true

Post by 246246 »

Also I believe property tiff:has-layers had worked properly:

Code: Select all

magick identify -format '%[tiff:has-layers]\n' out0-v6.tif[0]
identify: unknown image property "%[tiff:has-layers]" @ warning/property.c/InterpretImageProperties/3990.
This once returned "true" without warning. See https://www.imagemagick.org/discourse-s ... 45#p123969

Without [0],

Code: Select all

$ magick identify -format '%[tiff:has-layers]\n' out0-v6.tif
true
true
true
true
still works though.
246246
Posts: 190
Joined: 2015-07-06T07:38:22-07:00
Authentication code: 1151

Re: TIFF:ignore-layers=true

Post by 246246 »

In v6, I can remove them by the following command:

Code: Select all

% convert -quiet 10212_transparent_with_layers.tif +profile '37724,8bim' x1.tif
It seems Tag 34377 has to be referenced as 8bim.

Edit:

Code: Select all

% convert -quiet 10212_transparent_with_layers.tif +profile '8bim' x2.tif
is enough for remove photoshop related tag. It also remove 37724. xmp (700) and icc profile (34675) stays.
(I don't know why exif (34665) is also removed though.)
Last edited by 246246 on 2019-04-30T22:02:38-07:00, edited 1 time in total.
246246
Posts: 190
Joined: 2015-07-06T07:38:22-07:00
Authentication code: 1151

Re: TIFF:ignore-layers=true

Post by 246246 »

Sorry for confusing. Somewhere in analyzing, the file 10212_transparent_with_layers.tif had changed. It no longer output errors (except warinings) from ImageMagick.

So, if the command above does not work in v6, please just convert it first to remove something that caused ImageMagick error.

Code: Select all

% convert -quiet 10212_transparent_with_layers.tif tmp.tif
convert: improper image header `10212_transparent_with_layers.tif' @ error/psd.c/ReadPSDLayersInternal/1675.
Then apply +profile code.

Code: Select all

% convert tmp.tif +profile '8bim' result.tif
In v7, it directly works:

Code: Select all

$ magick convert -define tiff:ignore-layers=true 10212_transparent_with_layers.tif +profile '8bim'  result.tif
or

Code: Select all

$ magick convert 10212_transparent_with_layers.tif[0] +profile '8bim'  result.tif

---
EDIT:

Sorry the result above is also because of the odd behaviour by using relative path.

This is the way to remove layers using v6 only:

Code: Select all

$ convert -quiet -define tiff:ignore-layers=true 10212_transparent_with_layers.tif +profile '8bim,tiff:37724' result.tif
or

Code: Select all

$ convert -quiet 10212_transparent_with_layers.tif[0] +profile '8bim,tiff:37724' result.tif
It looks 'tiff:' is required to remove 37724 tag.

It worked with my version 6.9.9-40. I also removed 34377 tag (8bim). Even if that tag remains, ImageMagick recognize the file has no layers, but that I think that tag no longer needed once layers are removed.
Last edited by 246246 on 2019-05-01T04:16:22-07:00, edited 17 times in total.
246246
Posts: 190
Joined: 2015-07-06T07:38:22-07:00
Authentication code: 1151

Re: TIFF:ignore-layers=true

Post by 246246 »

After all, I think following seems to be a bug:
  • In v6, even without -define tiff:ignore-layers=true, it cannot extract the layer[0] only.

    In v7,

    Code: Select all

    $ magick convert -quiet -define tiff:ignore-layers=true 10212_transparent_with_layers.tif[0] x7.tif
    $ magick identify x7.tif 
    x7.tif TIFF 535x1336 535x1336+0+0 8-bit CMYK 605458B 0.000u 0:00.003
    
    or

    Code: Select all

    $ magick -quiet 10212_transparent_with_layers.tif[0] x7-2.tif
    $ magick identify x7-2.tif 
    x7-2.tif TIFF 535x1336 535x1336+0+0 8-bit CMYK 605458B 0.000u 0:00.003
    
    whereas

    Code: Select all

    $ convert -quiet -define tiff:ignore-layers=true 10212_transparent_with_layers.tif[0] x6.tif
    $ identify x6.tif 
    x6.tif[0] TIFF 535x1336 535x1336+0+0 8-bit CMYK 658720B 0.010u 0:00.000
    x6.tif[1] TIFF 142x246 142x246+11+230 8-bit CMYK 0.000u 0:00.000
    x6.tif[2] TIFF 29x213 29x213+17+240 8-bit CMYK 0.000u 0:00.000
    x6.tif[3] TIFF 37x58 37x58+54+245 8-bit CMYK 0.000u 0:00.000
    
    or

    Code: Select all

    $ convert -quiet 10212_transparent_with_layers.tif[0] x6-2.tif
    $ identify x6-2.tif 
    x6-2.tif[0] TIFF 535x1336 535x1336+0+0 8-bit CMYK 658720B 0.010u 0:00.000
    x6-2.tif[1] TIFF 142x246 142x246+11+230 8-bit CMYK 0.000u 0:00.000
    x6-2.tif[2] TIFF 29x213 29x213+17+240 8-bit CMYK 0.000u 0:00.000
    x6-2.tif[3] TIFF 37x58 37x58+54+245 8-bit CMYK 0.000u 0:00.000
    
  • Both in v6 and v7, tiff:has-layers property output warnings for non-layered tiff.

    Code: Select all

    $ identify -format '%[tiff:has-layers]\n' x7.tif 
    identify: unknown image property "%[tiff:has-layers]" @ warning/property.c/InterpretImageProperties/3924.
    
    $ magick identify -format '%[tiff:has-layers]\n' x7.tif 
    identify: unknown image property "%[tiff:has-layers]" @ warning/property.c/InterpretImageProperties/3990.
    
    With adding [0] to layered tiff, it does not return true.

    Code: Select all

    $ identify -quiet -format '%[tiff:has-layers]\n' 10212_transparent_with_layers.tif[0] 
    
    $ magick identify -quiet -format '%[tiff:has-layers]\n' 10212_transparent_with_layers.tif[0] 
    
246246
Posts: 190
Joined: 2015-07-06T07:38:22-07:00
Authentication code: 1151

Re: TIFF:ignore-layers=true

Post by 246246 »

246246 wrote: 2019-04-30T21:45:58-07:00 In v6, even without -define tiff:ignore-layers=true, it cannot extract the layer[0] only.
It turned out this is already solved in recent ImageMagick v6. I tried it with 6.9.10-42 comes with homebrew and found it behaves the same as the current v7.
Post Reply