class*args, **kwargs)[source]#

Represents a simple geo-located image.

  • filename – Filename of the image tile.

  • extent – The (x_lower, x_upper, y_lower, y_upper) extent of the image in units of the native projection.

  • origin – Name of the origin.

  • pixel_size – The (x_scale, y_scale) pixel width, in units of the native projection per pixel.


API is likely to change in the future to include a CRS.


Return a Polygon instance for this image’s extents.

count(value, /)#

Return number of occurrences of value.


Alias for field number 1


Alias for field number 0

classmethod from_world_file(img_fname, world_fname)[source]#

Return an Img instance from the given image filename and worldfile filename.

index(value, start=0, stop=9223372036854775807, /)#

Return first index of value.

Raises ValueError if the value is not present.


Alias for field number 2


Alias for field number 3

static world_file_extent(worldfile_handle, im_shape)[source]#

Return the extent (x0, x1, y0, y1) and pixel size (x_width, y_width) as defined in the given worldfile file handle and associated image shape (x, y).

static world_files(fname)[source]#

Determine potential world filename combinations, without checking their existence.

For example, a '*.tif' file may have one of the following popular conventions for world file extensions '*.tifw', '*.tfw', '*.TIFW' or '*.TFW'.

Given the possible world file extensions, the upper case basename combinations are also generated. For example, the file ‘map.tif’ will generate the following world file variations, ‘map.tifw’, ‘map.tfw’, ‘map.TIFW’, ‘map.TFW’, ‘MAP.tifw’, ‘MAP.tfw’, ‘MAP.TIFW’ and ‘MAP.TFW’.


fname – Name of the file for which to get all the possible world filename combinations.


A list of possible world filename combinations.


>>> from import Img
>>> Img.world_files('img.png')[:6]
['img.pngw', 'img.pgw', 'img.PNGW', 'img.PGW', 'IMG.pngw', 'IMG.pgw']
>>> Img.world_files('/path/to/img.TIF')[:2]
['/path/to/img.tifw', '/path/to/img.tfw']
>>> Img.world_files('/path/to/img/with_no_extension')[0]