Conversion to pyramidal tiled 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?".
Post Reply
Srividya
Posts: 2
Joined: 2012-01-17T03:40:18-07:00
Authentication code: 8675308

Conversion to pyramidal tiled tiff

Post by Srividya »

I am trying to convert a jpg to pyramidal tiled tiff file.
I am using ImageMagic 6.7.4.6. I used the command
convert inputImg.jpg -define tiff:tile-geometry=128x128 -compress jpeg ptif:outputImg.tif

I have a couple of questions/observations in this regard
1. Irrespective of the tile width and tile height specified, outputImg always has tiles of 256*256. Am I missing something here?
2. How many (pyramid) levels are created during this conversion? What resolution do these correspond to if my input Image is of resolution 100*100? Is it possible to specify the number of levels and the corresponding resolution of each level that we want in the output image.
3. Can we specify specific levels to be striped and others to be tiled. For eg: the lowest resolution to be striped and all other levels to be tiled?

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

Re: Conversion to pyramidal tiled tiff

Post by fmw42 »

Srividya wrote:I am trying to convert a jpg to pyramidal tiled tiff file.
I am using ImageMagic 6.7.4.6. I used the command
convert inputImg.jpg -define tiff:tile-geometry=128x128 -compress jpeg ptif:outputImg.tif

I have a couple of questions/observations in this regard
1. Irrespective of the tile width and tile height specified, outputImg always has tiles of 256*256. Am I missing something here?
2. How many (pyramid) levels are created during this conversion? What resolution do these correspond to if my input Image is of resolution 100*100? Is it possible to specify the number of levels and the corresponding resolution of each level that we want in the output image.
3. Can we specify specific levels to be striped and others to be tiled. For eg: the lowest resolution to be striped and all other levels to be tiled?

Regards,
Srividya

I don't know too much about all the details and will defer to others more expert in this, but I believe the basics are:

1) you cannot have multiple levels if your image is smaller than the tile size. so 100x100 is too small for tiles of 256x256 to get multiple levels and you will always get one level with one tile of size 256x256, I suspect which will pad your 100x100 image.
2) the number of levels will depend upon the size of your image and the size of the tiles. For example if your image is 1024x1024, you will get 3 levels for tile size=256x256 (256x256, 512x512 and 1024x1024). If your image is large enough to have multiple levels, I don't know if you can specify a subset of the levels.
3) i don't know if you can mix striping and tiling, but I doubt it

See pyramid tiff format by searching google, for example
http://www.digitalpreservation.gov/form ... 0237.shtml
Srividya
Posts: 2
Joined: 2012-01-17T03:40:18-07:00
Authentication code: 8675308

Re: Conversion to pyramidal tiled tiff

Post by Srividya »

Hi,
The image size is 3264x2448. What I meant was that this image is captured at 100x resolution. (My earlier post was wrongly worded).

And even if I specify the tile-geometry as 128*128, still tiles of 256*256 are generated.

Also, the details given by identify for the outputImg.tif is as follows:
oImg.tif[0] TIFF 3264x2448 3264x2448+0+0 8-bit DirectClass 4.954MB 0.000u 0:00.000
oImg.tif[1] TIFF 1632x1224 1632x1224+0+0 8-bit DirectClass 4.954MB 0.000u 0:00.000
oImg.tif[2] TIFF 816x612 816x612+0+0 8-bit DirectClass 4.954MB 0.000u 0:00.000
oImg.tif[3] TIFF 408x306 408x306+0+0 8-bit DirectClass 4.954MB 0.000u 0:00.000
oImg.tif[4] TIFF 204x153 204x153+0+0 8-bit DirectClass 4.954MB 0.000u 0:00.000
oImg.tif[5] TIFF 102x76 102x76+0+0 8-bit DirectClass 4.954MB 0.000u 0:00.000
oImg.tif[6] TIFF 51x38 51x38+0+0 8-bit DirectClass 4.954MB 0.000u 0:00.000

So, levels of even less than 256*256 are created. That is the reason why I wanted to know how many levels are created.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Conversion to pyramidal tiled tiff

Post by fmw42 »

I get:


convert -size 1024x1024 gradient: grad1024.png
convert grad1024.png -define tiff:tile-geometry=128x128 ptif:grad1024.tif

identify grad1024.tif
grad1024.tif[0] TIFF 1024x1024 1024x1024+0+0 16-bit Grayscale DirectClass 42.7KB 0.000u 0:00.000
grad1024.tif[1] TIFF 512x512 512x512+0+0 16-bit Grayscale DirectClass 42.7KB 0.000u 0:00.000
grad1024.tif[2] TIFF 256x256 256x256+0+0 16-bit Grayscale DirectClass 42.7KB 0.000u 0:00.000
grad1024.tif[3] TIFF 128x128 128x128+0+0 16-bit Grayscale DirectClass 42.7KB 0.000u 0:00.000
grad1024.tif[4] TIFF 64x64 64x64+0+0 16-bit Grayscale DirectClass 42.7KB 0.000u 0:00.000

I also get the same results from using -define tiff:tile-geometry=256x256

So it looks to me like it is creating tiles of 64x64, which may be the default and thus the -define is not working or not documented correctly.

I would think you have found a bug. I will put in a bug report.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Conversion to pyramidal tiled tiff

Post by fmw42 »

See bug report for more details, but to make PTIF usable it should be 8-bits and not 16-bits.


Turns out that GIMP will display PTIFs (all levels or select a level) as images or layers, BUT only if the image is depth 8. In IM, display and Mac Preview will only show the first level (largest) but also only if -depth 8

So use:

convert -size 1024x1024 gradient: grad1024.png
convert grad1024.png -define tiff:tile-geometry=128x128 -depth 8 ptif:grad1024.tif
Post Reply