2007.06.17 14:00 "[Tiff] Converting from Striped TIFF into Tiled TIFF", by Full Midnight

2007.06.18 15:00 "Re: [Tiff] Converting from Striped TIFF into Tiled TIFF", by Bob Friesenhahn

When I attempt to load your striped.tiff file, I see this error message from libtiff:

   "Compression algorithm does not support random access."

so it seems that libtiff itself does not want to read this file. There must be some limitation related to the PackBits compression.

The tiffcp from recent libtiff reports:

% tiffcp -t -w 256 -l 256 -p separate striped.tiff tiled.tiff striped.tiff: Compression algorithm does not support random access.

striped.tiff: Error, can't read scanline 1.

Bob

On Mon, 18 Jun 2007, Full Midnight wrote:

> Hello Bob,
>
> Thank you for your quick reply! :)
> The output tiff should be also in CMYK, as the input file. And planar +
> tiled, yes! :)
>
> Given the Input file below:
> -------
> tiffinfo -s -z striped.tiff
> TIFF Directory at offset 0x564144
> Image Width: 1600 Image Length: 1200
> Resolution: 119.99, 119.99 pixels/inch
> Bits/Sample: 8
> Compression Scheme: PackBits
> Photometric Interpretation: separated
> Ink Set: CMYK
> Samples/Pixel: 4
> Rows/Strip: (infinite)
> Planar Configuration: separate image planes
> 4 Strips:
>     0: [       8,  1396041]
>     1: [ 1396049,  1419801]
>     2: [ 2815850,  1414917]
>     3: [ 4230767,  1422036]
> -------
>
> ..., after converting it using tiffcp:
>
> -------
> tiffcp -t -w 256 -l 256 -p separate striped.tiff tiled.tiff && tiffinfo -s
> -z tiled.tiff && ls -al tiled.tiff && ls -al striped.tiff
> striped.tiff: Warning, using top-left orientation.
> striped.tiff: Compression algorithm does not support random access.
> TIFF Directory at offset 0x241f2
> Image Width: 1600 Image Length: 1200
> Tile Width: 256 Tile Length: 256
> Resolution: 119.99, 119.99 pixels/inch
> Bits/Sample: 8
> Compression Scheme: PackBits
> Photometric Interpretation: separated
> Ink Set: CMYK
> Orientation: row 0 top, col 0 lhs
> Samples/Pixel: 4
> Planar Configuration: separate image planes
> 140 Tiles:
>     0: [       8,     1167]
>     1: [    4676,     1184]
>     2: [    9408,     1172]
>     3: [   14080,     1187]
>     4: [   18836,     1193]
>     5: [   23606,     1205]
>     6: [   28426,     1210]
>     7: [   33266,     1024]
>     8: [   37362,     1024]
>     9: [   41458,     1024]
>    10: [   45554,     1024]
>    11: [   49650,     1024]
>    12: [   53746,     1024]
>    13: [   57842,     1024]
>    14: [   61938,     1024]
>    15: [   66034,     1024]
>    16: [   70130,     1024]
>    17: [   74226,     1024]
>    18: [   78322,     1024]
>    19: [   82418,     1024]
>    20: [   86514,     1024]
>    21: [   90610,     1024]
>    22: [   94706,     1024]
>    23: [   98802,     1024]
>    24: [  102898,     1024]
>    25: [  106994,     1024]
>    26: [  111090,     1024]
>    27: [  115186,     1024]
>    28: [  119282,     1024]
>    29: [  123378,     1024]
>    30: [  127474,     1024]
>    31: [  131570,     1024]
>    32: [  135666,     1024]
>    33: [  139762,     1024]
>    34: [  143858,     1024]
>    35: [    1175,     1167]
>    36: [    5860,     1184]
>    37: [   10580,     1168]
>    38: [   15267,     1187]
>    39: [   20029,     1191]
>    40: [   24811,     1205]
>    41: [   29636,     1210]
>    42: [   34290,     1024]
>    43: [   38386,     1024]
>    44: [   42482,     1024]
>    45: [   46578,     1024]
>    46: [   50674,     1024]
>    47: [   54770,     1024]
>    48: [   58866,     1024]
>    49: [   62962,     1024]
>    50: [   67058,     1024]
>    51: [   71154,     1024]
>    52: [   75250,     1024]
>    53: [   79346,     1024]
>    54: [   83442,     1024]
>    55: [   87538,     1024]
>    56: [   91634,     1024]
>    57: [   95730,     1024]
>    58: [   99826,     1024]
>    59: [  103922,     1024]
>    60: [  108018,     1024]
>    61: [  112114,     1024]
>    62: [  116210,     1024]
>    63: [  120306,     1024]
>    64: [  124402,     1024]
>    65: [  128498,     1024]
>    66: [  132594,     1024]
>    67: [  136690,     1024]
>    68: [  140786,     1024]
>    69: [  144882,     1024]
>    70: [    2342,     1167]
>    71: [    7044,     1182]
>    72: [   11748,     1166]
>    73: [   16454,     1191]
>    74: [   21220,     1193]
>    75: [   26016,     1205]
>    76: [   30846,     1210]
>    77: [   35314,     1024]
>    78: [   39410,     1024]
>    79: [   43506,     1024]
>    80: [   47602,     1024]
>    81: [   51698,     1024]
>    82: [   55794,     1024]
>    83: [   59890,     1024]
>    84: [   63986,     1024]
>    85: [   68082,     1024]
>    86: [   72178,     1024]
>    87: [   76274,     1024]
>    88: [   80370,     1024]
>    89: [   84466,     1024]
>    90: [   88562,     1024]
>    91: [   92658,     1024]
>    92: [   96754,     1024]
>    93: [  100850,     1024]
>    94: [  104946,     1024]
>    95: [  109042,     1024]
>    96: [  113138,     1024]
>    97: [  117234,     1024]
>    98: [  121330,     1024]
>    99: [  125426,     1024]
>   100: [  129522,     1024]
>   101: [  133618,     1024]
>   102: [  137714,     1024]
>   103: [  141810,     1024]
>   104: [  145906,     1024]
>   105: [    3509,     1167]
>   106: [    8226,     1182]
>   107: [   12914,     1166]
>   108: [   17645,     1191]
>   109: [   22413,     1193]
>   110: [   27221,     1205]
>   111: [   32056,     1210]
>   112: [   36338,     1024]
>   113: [   40434,     1024]
>   114: [   44530,     1024]
>   115: [   48626,     1024]
>   116: [   52722,     1024]
>   117: [   56818,     1024]
>   118: [   60914,     1024]
>   119: [   65010,     1024]
>   120: [   69106,     1024]
>   121: [   73202,     1024]
>   122: [   77298,     1024]
>   123: [   81394,     1024]
>   124: [   85490,     1024]
>   125: [   89586,     1024]
>   126: [   93682,     1024]
>   127: [   97778,     1024]
>   128: [  101874,     1024]
>   129: [  105970,     1024]
>   130: [  110066,     1024]
>   131: [  114162,     1024]
>   132: [  118258,     1024]
>   133: [  122354,     1024]
>   134: [  126450,     1024]
>   135: [  130546,     1024]
>   136: [  134642,     1024]
>   137: [  138738,     1024]
>   138: [  142834,     1024]
>   139: [  146930,     1024]
> -rw-rw-r--  1 xx xx 149296 Jun 18 11:57 tiled.tiff
> -rw-rw-r--  1 xx xx 5653034 Jun 18 10:44 striped.tiff
> -------
>
> It seems that the tiled image size is only 150k instead of 5.6MB.. so
> something is wrong..
> I've also tried with "-p contig", and the size of tiled.tiff is still below
> 200k.
> Just in case, I have uploaded the tiled.tiff and stripped.tiff here:
> ---
> http://rapidshare.com/files/37890126/tiled.tiff.html
> http://rapidshare.com/files/37889942/striped.tiff.html
> ---
> Note that in order to view the stripped tiff, you need an image viewer which
> is capable of viewing separate planes (I use CinePaint, but I've heard that
> Photoshop reads it, too). Gimp doesn't seem to like it ("Unsupported layout.
> No RGBA loader").
>
> On another side, does anyone know how could I use libtiff in order to do
> this? (i.e. the "logic")
>
> Thank you very much,
> Marius.
>
> On 6/17/07, Bob Friesenhahn <bfriesen@simple.dallas.tx.us> wrote:

Let me please explain what I am trying to accomplish:

As Input, we have a Striped TIFF (Photometric Interpretation: separated and Planar Configuration: separate image planes, where each strip below represents one plane of the CMYK) with the following characteristics:

And what we would like to achieve is a tiled TIFF using the above input TIFF.

Can someone please tell me if the libtiff (or any of its tools) are capable of doing this type of "conversion"? And if so, using which call/tool?

While I know that development GraphicsMagick 1.2 can deal with your file, have you tried libtiff's 'tiffcp' program? It is intended for these tasks. Since your image is fairly large, make sure that your system has plenty of RAM available.

Do you want the output file to be RGBA tiled only (consecutive samples), or planar+tiled?

>

======================================
Bob Friesenhahn
bfriesen@simple.dallas.tx.us, http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer, http://www.GraphicsMagick.org/