Module for Python to call Krpano kmaketiles tools to tile, resize and convert images.
The Krpano Viewer is a small and very flexible high-performance viewer for all kind of panoramic images and interactive virtual tours.
Currently, there are only two ways to use this module.
. tile_full() can tile spherical images to cubical images, resize sphere images. . sources(pano_path) get full image sources, return absolute image path.
How to use:
from krpano_tool.krpano import krpano image_path = "path_to_your_image/test.jpg" krpano.tile_full(image_path)
from krpano_tool.source import source pano_path = "http : //host/pano-path" source.sources(pano_path)
Linux: krpanotools-1.16.9-linux64.tar.gz
Mac: krpanotools-1.16.9-mac64.zip
Krpano download
You need to overwrite “krpanotools.license” file with your license, or krpano tools will have each image covered with full watermark.
When I used this krpano tool within a Django project, I changed the variable “KRPANO_BASE_DIR” to the following:
from django.conf import settings KRPANO_BASE_DIR = settings.BASE_DIR
$ python test_krpano.py
20140517143710900926_xrkjkkit.zip
$ python test_source.py
{
"origin": "http : //host/path/origin.jpg",
"thumb": "http : //host/path/thumb.jpg",
"sphere": {
"preview": "http : //host/path/sphere/preview.jpg",
"2048": [
"high": "http : //host/path/sphere/2048h.jpg",
"medium": "http : //host/path/sphere/2048m.jpg",
"low": "http : //host/path/sphere/2048l.jpg"
],
"1024": [
"high": "http : //host/path/sphere/1024h.jpg",
...
],
"512": [
"high": "http : //host/path/sphere/512h.jpg",
...
]
},
"cube": {
"preview": "http : //host/path/cube/preview.jpg",
"2048": {
"high": "http : //host/path/cube/2048h_%s",
"medium": "http : //host/path/cube/2048m_%s",
"low": "http : //host/path/cube/2048l_%s"
},
"1024": [
"high": "http : //host/path/cube/1024h_%s",
...
],
"512": [
"high": "http : //host/path/cube/512h_%s",
...
],
"tiles": {
"2048": "http : //host/path/cube/tiles/2048/%s/%v_%h.jpg",
"1024": "http : //host/path/cube/tiles/1024/%s/%v_%h.jpg",
"512": "http : //host/path/cube/tiles/512/%s/%v_%h.jpg"
}
}
}