10
M agickTiler A Java tool and embeddable library for converting images into formats suitable for publishing as zoomable Web images. http://code.google.com/p/magicktiler/

MagickTiler at Toronto JUG

Embed Size (px)

DESCRIPTION

http://code.google.com/p/magicktiler

Citation preview

Page 1: MagickTiler at Toronto JUG

MagickTilerA Java tool and embeddable library for converting images into

formats suitable for publishing as zoomable Web images.

http://code.google.com/p/magicktiler/

Page 2: MagickTiler at Toronto JUG

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...)

⌈ ⌉

Page 3: MagickTiler at Toronto JUG

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.

Page 4: MagickTiler at Toronto JUG

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.

Page 5: MagickTiler at Toronto JUG

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.

Page 6: MagickTiler at Toronto JUG

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!

Page 7: MagickTiler at Toronto JUG

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

Page 8: MagickTiler at Toronto JUG

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

Page 9: MagickTiler at Toronto JUG

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

Page 10: MagickTiler at Toronto JUG

Finally, some Java!