Date post: | 18-Dec-2014 |
Category: |
Technology |
Upload: | aboutgeo |
View: | 2,195 times |
Download: | 0 times |
MagickTilerA Java tool and embeddable library for converting images into
formats suitable for publishing as zoomable Web images.
http://code.google.com/p/magicktiler/
Image Tiling Basics – The Pyramid
X
Y
X/2
Y/2
Y/4
X/4 X/8
Y/8
{ }No. of zoom levels = log2 max , + 1 x
tilewidthy
tileheight
(some math...)
⌈ ⌉
Tiling Schemes
• Zoomify• TMS• Google Maps• MS Deep Zoom• …
Variations are in the details…
tile naming, directory layout, file formats and sizes, descriptor files, handling of irregular tile sizes.
TMS 1
1 as supported by OpenLayers
<zoom-level><c olumn>
row .jpg / pngrow .jpg / png…
/0/2.jpg
/0/1.jpg
/0/0.jpg
/1/2.jpg
/1/1.jpg
/1/0.jpg
/2/2.jpg
/2/1.jpg
/2/0.jpg Tile (x and y) M U S T be n x tilesize!Borders M U S T be top/right.
Zoomify<TileG roupX >
<level>-<c ol>-<row >.jpg<level>-<c ol>-<row >.jpg
…
-0-0.jpg
-0-1.jpg
-0-2.jpg
-1-0.jpg
-1-1.jpg
-1-2.jpg
-2-0.jpg
-2-1.jpg
-2-2.jpg
Irregular tiles M U S T bebottom/right.
Zoomify: TileGroups (The Tricky Part)
1
3
2
4
5
8
11
6
9
12
7
10
13
0
● Starting with the lowest zoom level (1x1 tile)● Count! (left->right, top->bottom)● Start a new TileGroup after 256 tiles!
Google Maps• Resize the longest dimension to the closest 256n²
• Square the image using background-colour bufer
• Tiles are square (256x256)
• Tiles per zoomlevel: 4zoomlevel
-0-0 -3-0-2-0-1-0
-0-1
-0-2
-0-3
-1-1
-1-2
-1-3
-2-1
-2-2
-2-3
-3-1
-3-2
-3-3
<out-dir><level>-<c ol>-<row >.jpg<level>-<c ol>-<row >.jpg
…
Performance Optimizations
• Striping– The base image is cut into either horizontal or
vertical stripes to avoid operations on 'large' images
– For each zoom level, the stripes are generated based on the stripes of the previous zoomlevel (stripes are merged)
• Single GM/IM operations where possible
CLIusage: java -jar magicktiler [-b <color>] [-f <format>] [-g] [-h] -i
<input> [-l] [-o <output>] [-p] [-q <quality>] -s <scheme> [-v]
-b <color> background color, default=white
-f <format> tile format ('jpeg' or 'png'), default=jpeg
-g displays the GUI (ignores all other parameters)
-h displays this help text
-i <input> mandatory input file or directory
-l writes reporting information to a log file
-o <output> output directory (for tilesets) or file (for PTIF), default=.
-p generate an HTML preview file
-q <quality> JPEG compression quality (0 - 100), default=75
-s <scheme> mandatory tiling scheme ('tms', 'zoomify', 'gmap' or 'ptif')
-v validate the input instead of generating a tileset
Example: java -jar magicktiler.jar -s tms -f jpeg -i image.tif -p
Finally, some Java!