Several sites are using the Tilepic image format to show sections of a larger image. The Tilepic file format contains the image data for a limited number of resolutions (levels) and all image parts (tiles) have the same dimensions. The first level contains the full image scaled to a single tile. The second level could contain 4 tiles of the same size, each containing a quarter of the image data at twice the resolution of the first level. The third level then contains 4 tiles for each tile of the second level, resulting in a total of 16 tiles for the full image. The advantage of the Tilepic format is that the client only needs to download the specific tiles for the shown part of the image from the level with the correct resolution. The websites usually provide zoom and scroll functions to magnify a part of the image.
Downloading the high-resolution image from the Tilepic file requires some knowledge on the location of the file on the server. This information can be found in the source code of the webpage and may for example be /photo/tilepic/image.tjp. The following script will download all tiles from all levels of the Tilepic image defined by $file.
file='http://www.reconbyfire.net/cgi-bin/getpic?photo/tilepic/image.tjp' images=`wget $file -q -O - | grep numfiles | awk -F= '{print $2}'` for ((i = 1; i <= images; i++)) do wget $file'&'$i -q echo $i' of '$images done
After downloading all tiles, the number of tiles ($cols and $rows) of the highest level can easily be determined. The $first parameter is the file number of the tile in the upper left corner in this level. The following script will stitch the tiles of the highest level to re-create the high-resolution image. The tiles in the last column and last row will not have the same dimensions as the other tiles, because the resolution of the original image is unlikely to be an exact multiple of a single tile. The programs montage and convert are part of the ImageMagick package.
file='getpic?photo%2Ftilepic%2Fimage.tjp&' cols=30 rows=20 first=208 for ((j = 1; j <= $rows; j++)) do string='' for ((i = ($first+($j-1)*$cols); i < ($first+$j*$cols); i++)) do string=$string' '$file$i echo $j' of '$rows' image '$i done montage $string -tile $cols''x1 -mode concatenate row$j.jpg done string='' for ((j = 1; j <= $rows; j++)) do string=$string' 'row$j.jpg done convert $string -append final.jpg
The satellite photographs provided by Google Maps are also served in tiles and a similar script can be made to download the images of a particular area. However, the tiles have been named in a quadrant-like structure, which requires a more complicated script to stitch the tiles with rows and columns.