HomeNewsExamplesDocumentationToolsPluginsMoreDownloadBuyForumContact
close panorama

kmaketiles


syntax:
kmaketiles 1.1 (krpano.com - krpanotools 1.0.6)

    - splits a image into smaller tiles
    - merges tiles into one image or to other sized tiles
    - high quality resize of images or tiled images
    - fast and very memory-efficient


syntax: 
  kmaketiles inputfile outputfile tilesize [options]


 inputfile  ... jpeg or tiff input image
                (only 8bit GRAY,RGB,RGBA supported)
 outputfile ... jpeg or tiff output image template
                (path's will be created)
                template syntax: %[*0]{H|V}
                %H = horizontal tilenumber  
                     eg. %H   =>   1,  2 ...  10 ... 100
                %V = vertical   tilenumber  
                     eg. %00V => 001,002 ... 010 ... 100
                examples:  "tiles_%v_%h.jpg" or "t_%0v_%0h.jpg" ...
 tilesize   ... tilesize 
                (0 to disable tiling, #x# for non quad tilesizes)

options:
-indexbase=#    ... set numbering start of tiles (default=1)
-jpegquality=#  ... set jpeg quality (0-100; default=85)
-jpegsubsamp=#  ... set jpeg color subsampling
                    (444,422,420,411; default=444)
-jpegoptimize   ... optimize jpeg compression
-tiffcompress=# ... set tiff compression
                    (none,lzw,zip,jpeg; default=lzw)
-tiffnoalpha    ... remove tiff alpha channel if present
-q / -quiet     ... suppress output messages

for a tiled input image: (use template syntax also for inputfile)
-insize=#x#     ... input image [width]x[height]
-intilesize=#   ... input image tilesize in pixels 
                    (default=0, one image)
-inindexbase=#  ... input image numbering start of tiles (default=1)

for resizing image:
-resize=#x#     ... resize inputimage to [width]x[height]
                    (* for proportional)
-hwrap          ... wrap around horizontally when filtering
-filter=#       ... resize filter (default=LANCZOS)
                    filters: POINT,LINEAR,GAUSS,CUBIC,HAMMING,
                             MITCHELL,LANCZOS


Tutorials


1. Create a multi-resolution panorama

For example you have a large spherical panorama image: 20000x10000 pixel. A good tilesize for this image will be 1000 pixel. So you get 20x10 tiles (=20000/1000 x 10000/1000).
To create the tiles:
kmaketiles sphere.jpg tiles_l0_%0v_%0u.jpg 1000
Therefore you get 200 images with size 1000x1000 and named "tiles_l0_01_01.jpg" to "tiles_l0_10_20.jpg". Now it's time to make some lower resolution images. A good resolution step is 2! So the next lower resolution is 10000x5000, the next 5000x2500, and at last 2500x1250.
To create the tiles for this resolutions:
kmaketiles sphere.jpg tiles_l1_%0v_%0u.jpg 1000 -resize=10000x5000 -hwrap
kmaketiles sphere.jpg tiles_l2_%0v_%0u.jpg 1000 -resize=5000x2500 -hwrap
kmaketiles sphere.jpg tiles_l3_%0v_%0u.jpg 1000 -resize=2500x1250 -hwrap
The "-hwrap" is to wrap the resize filter around the horizonal edges.
Additional you can add "-jpegoptimize", "-jpegsubsamp=420" and "-jpegquality=75" for a better JPEG compression.

The XML code for these tiles:
<krpano version="1.0">
    <image type="SPHERE" multires="yes" tilesize="1000">
        <level tiledimagewidth="20000" tiledimageheight="10000">
            <sphere url="tiles_l0_%0v_%0u.jpg" />
        </level>
        <level tiledimagewidth="10000" tiledimageheight="5000">
            <sphere url="tiles_l1_%0v_%0u.jpg" />
        </level>
        <level tiledimagewidth="5000" tiledimageheight="2500">
            <sphere url="tiles_l2_%0v_%0u.jpg" />
        </level>
        <level tiledimagewidth="2500" tiledimageheight="1250">
            <sphere url="tiles_l3_%0v_%0u.jpg" />
        </level>
    </image>
</krpano>



2. Downsize large images

kmaketiles can also be used to downsize images in a very high quality. kmaketiles uses the "lanczos" filter by default. This filter keeps the most details when downsampling.
To resize set to tilesize to 0.

for example:
kmaketiles largeimage.jpg smallimage.jpg 0 -resize=1024x768