large_image_source_dummy package

Module contents

class large_image_source_dummy.DummyTileSource(*args, **kwargs)[source]

Bases: TileSource

Initialize the tile class.

  • jpegQuality – when serving jpegs, use this quality.

  • jpegSubsampling – when serving jpegs, use this subsampling (0 is full chroma, 1 is half, 2 is quarter).

  • encoding – ‘JPEG’, ‘PNG’, ‘TIFF’, or ‘TILED’.

  • edge – False to leave edge tiles whole, True or ‘crop’ to crop edge tiles, otherwise, an #rrggbb color to fill edges.

  • tiffCompression – the compression format to use when encoding a TIFF.

  • style

    if None, use the default style for the file. Otherwise, this is a string with a json-encoded dictionary. The style can contain the following keys:


    if -1 or None, and if style is specified at all, the greyscale value is used. Otherwise, a 1-based numerical index into the channels of the image or a string that matches the interpretation of the band (‘red’, ‘green’, ‘blue’, ‘gray’, ‘alpha’). Note that ‘gray’ on an RGB or RGBA image will use the green band.


    if specified, override the frame value for this band. When used as part of a bands list, this can be used to composite multiple frames together. It is most efficient if at least one band either doesn’t specify a frame parameter or specifies the same frame value as the primary query.


    if specified and frame is not specified, override the frame value for this band by using the current frame plus this value.


    the value to map to the first palette value. Defaults to 0. ‘auto’ to use 0 if the reported minimum and maximum of the band are between [0, 255] or use the reported minimum otherwise. ‘min’ or ‘max’ to always uses the reported minimum or maximum. ‘full’ to always use 0.


    the value to map to the last palette value. Defaults to 255. ‘auto’ to use 0 if the reported minimum and maximum of the band are between [0, 255] or use the reported maximum otherwise. ‘min’ or ‘max’ to always uses the reported minimum or maximum. ‘full’ to use the maximum value of the base data type (either 1, 255, or 65535).


    a list of two or more color strings, where color strings are of the form #RRGGBB, #RRGGBBAA, #RGB, #RGBA, or any string parseable by the PIL modules, or, if it is installed, byt matplotlib. Alternately, this can be a single color, which implies [‘#000’, <color>], or the name of a palettable paletter or, if available, a matplotlib palette.


    the value to use for missing data. null or unset to not use a nodata value.


    either ‘lighten’ or ‘multiply’. Defaults to ‘lighten’ for all except the alpha band.


    either True to clamp (also called clip or crop) values outside of the [min, max] to the ends of the palette or False to make outside values transparent.


    convert the results to the specified numpy dtype. Normally, if a style is applied, the results are intermediately a float numpy array with a value range of [0,255]. If this is ‘uint16’, it will be cast to that and multiplied by 65535/255. If ‘float’, it will be divided by 255.


    keep only the specified axis from the numpy intermediate results. This can be used to extract a single channel after compositing.

    Alternately, the style object can contain a single key of ‘bands’, which has a value which is a list of style dictionaries as above, excepting that each must have a band that is not -1. Bands are composited in the order listed. This base object may also contain the ‘dtype’ and ‘axis’ values.

classmethod canRead(*args, **kwargs)[source]

Check if we can read the input. This takes the same parameters as __init__.


True if this class can read the input. False if it cannot.

extensions = {None: 9}

A dictionary of known file extensions and the SourcePriority given to each. It must contain a None key with a priority for the tile source when the extension does not match.

getTile(x, y, z, **kwargs)[source]

Get a tile from a tile source, returning it as an binary image, a PIL image, or a numpy array.

  • x – the 0-based x position of the tile on the specified z level. 0 is left.

  • y – the 0-based y position of the tile on the specified z level. 0 is top.

  • z – the z level of the tile. May range from [0, self.levels], where 0 is the lowest resolution, single tile for the whole source.

  • pilImageAllowed – True if a PIL image may be returned.

  • numpyAllowed – True if a numpy image may be returned. ‘always’ to return a numpy array.

  • sparseFallback – if False and a tile doesn’t exist, raise an error. If True, check if a lower resolution tile exists, and, if so, interpolate the needed data for this tile.

  • frame – the frame number within the tile source. None is the same as 0 for multi-frame sources.


either a numpy array, a PIL image, or a memory object with an image file.

name = 'dummy'

Name of the tile source

large_image_source_dummy.canRead(*args, **kwargs)[source]

Check if an input can be read by the module class.*args, **kwargs)[source]

Create an instance of the module class.