/tiles contains the Image Pyramid.
The Image Pyramid contains 256x256 pixel jpeg tiles for the whole image at each
zoom level.
Different images have different numbers of zoom levels. The more pixels the more
zoom levels. See the 'nlevels' parameter for a particular image. See 'tile math'
below.
These images are named in a Quadtree
fashion. The initial full image is r.jpg. To zoom in the image is split into four pieces.
Add a digit to the filename from 0-3. Whee 0 is the upper left, 1 the upper right, 2 lower left, and 3 lower right.
Here is an example of the naming structure for zoom level one (r), two (r0), and three (r00), along
with matching tiles from a sample image.
Direct Access To Tiles
Tiles live on the gigapan server. Here is a link to the top level tile for the above gigapan 2770.

http://share.gigapan.org/gigapans0/2770/tiles/r.jpg
And here is direct link to a tile further down:

http://share.gigapan.org/gigapans0/2770/tiles/r01.jpg
In order to have a manageable number of files in a directory each three digits (including
the 'r') or three zoom levels, the tiles are split into subdirectories. So to get the
next level down requires another level in the url:

http://share.gigapan.org/gigapans0/2770/tiles/r01/r010.jpg
You can then descend three more zoom levels by just changing the file name. This
image could be read as the top right of the top right of the lower left of the upper
left of the full image :-)

http://share.gigapan.org/gigapans0/2770/tiles/r01/r01211.jpg
Because the name is now 6 characters we need to drop down a directory level in
order to get the next zoom level:

http://share.gigapan.org/gigapans0/2770/tiles/r01/211/r012113.jpg
This image only has seven zoom levels, but
here is a tile from the tenth level of a ten level gigapan.

http://share.gigapan.org/gigapans0/5517/tiles/r10/000/121/r100001210.jpg
That is the top left tile
of the top right tile
of the lower left tile
of the top right tile
of the top left tile
of the top left tile
of the top left tile
of the top left tile
of the top right tile
Of the full image...
Converting between tile space and pixel space
There is a simple function to map from any point within an image to the tile
which includes that point, or from any tile to the 256 x 256 pixels which
are contained within that tile.
Sadly I have not written it yet :-)
Converting between tile space and filename space
Another simple function does this :-)
Just throw in a directory for every three characters of the tile name.
Tile Math and Number of Levels
The number of tile or zoom levels in a panorama can be determined in a couple of ways.
If you have the .data directory then descend as far as you can until you get to
a directory with no subdirectories, then count the number of characters in the
longest filename. For example, I have a gigapan where I can descend like this:
where_bay_01b.data/tiles/r00/000/000/r000000000.jpg
There is the 'r' plus nine 0's, so the number of levels will be 10.
You can also calculate the number of levels from a full size image (such as as tif exported
by the stitcher).
- Determine the height and width
(I use gdalinfo from the FWTools Open Source GIS Toolkit)
gdalinfo where_bay_01b.tif
Size is 88415, 13518
- Select the larger, 88415 in this case, and divide by 256
88415/256=345 (and change)
- Take the square
345^2 = 119025
- Find the 4th root
- Round up
- Add one...
(or just use this table-this assumes a square image. Non-square images
will be smaller, and uneeded tiles will not be generated)
Using the table, I find level 9 is up to 65,536 pixels on a side, and level
ten is up to 131,076. My image is 88,415, so rounding up it is level ten.
level |
max pixels wide or high |
Total Tiles |
sample file name |
1 |
256 |
1 |
r.jpg |
2 |
512 |
4 |
r0.jpg |
3 |
1024 |
16 |
r00.jpg |
4 |
2048 |
64 |
r000.jpg |
5 |
4096 |
256 |
r0000.jpg |
6 |
8192 |
1024 |
r00000.jpg |
7 |
16384 |
4096 |
r000000.jpg |
8 |
32768 |
16384 |
r0000000.jpg |
9 |
65536 |
65536 |
r00000000.jpg |
10 |
131072 |
262144 |
r000000000.jpg |
11 |
262144 |
1048576 |
r0000000000.jpg |
An image with ten levels can be up to 17 gigapixels. A square panorama with Eleven levels
would be 68+ gigapixels. I know there are images with ten levels, I have not actually
seen an eleven level image.