# Equirectangular tiles

NPM version NPM Downloads jsDelivr Hits

Reduce the initial loading time and used bandwidth by slicing big equirectangular panoramas into many smaller tiles.

This adapter is available in the @photo-sphere-viewer/equirectangular-tiles-adapter (opens new window) package.

const viewer = new PhotoSphereViewer.Viewer({
    adapter: PhotoSphereViewer.EquirectangularTilesAdapter,
    panorama: {
        width: 12000,
        cols: 16,
        rows: 8,
        baseUrl: 'panorama_low.jpg',
        tileUrl: (col, row) => {
            return `panorama_${col}_${row}.jpg`;
        },
    },
});

# Example

Positions definitions

With this adapter, pixel positions refer to the full size of the panorama (first level when using multi-levels tiles).

# Configuration

# baseBlur

  • type: boolean
  • default: true

Applies a blur filter to the base image (option baseUrl).

# showErrorTile

  • type: boolean
  • default: true

Shows a warning sign on tiles that cannot be loaded.

# antialias

  • type: boolean
  • default: true

Applies antialiasing to high resolutions tiles.

# backgroundColor

See the equirectangular adapter configuration.

# resolution

See the equirectangular adapter configuration.

# Panorama options

When using this adapter, the panorama option and the setPanorama() method accept an object to configure the tiles.

You may choose to provide a single tiles configuration or multiple configurations which will be applied at different zoom levels, this allows to serve files adapted to the current zoom level and achieve very high resolutions without consuming too much bandwidth.

# Preparing the panorama

The tiles can be easily generated using ImageMagick (opens new window) tool.

Let's say you have a 12.000x6.000 pixels panorama you want to split in 16 columns and 8 rows, use the following command:

magick.exe panorama.jpg \
  -crop 750x750 -quality 95 \
  -set filename:tile "%[fx:page.x/750]_%[fx:page.y/750]" \
  -set filename:orig %t \
  %[filename:orig]_%[filename:tile].jpg

You can also use this online tool (opens new window).

Performances

It is recommanded to not exceed tiles with a size of 1024x1024 pixels, thus limiting the maximum panorama size to 65.536x32.768 pixels (2 Gigapixels).