GDAL plugin added.

This commit is contained in:
Riaan van den Dool
2011-10-10 11:52:07 +02:00
parent 47a2c289bd
commit 022aac779f
2 changed files with 23 additions and 0 deletions
@@ -0,0 +1,4 @@
[gdal]
description = Image reading via the GDAL Library (www.gdal.org)
provides = imread
+19
View File
@@ -0,0 +1,19 @@
__all__ = ['imread']
import numpy as np
try:
import osgeo.gdal as gdal
except ImportError:
raise ImportError("The GDAL Library could not be found. "
"Please refer to http://www.gdal.org/ "
"for further instructions.")
def imread(fname, dtype=None):
"""Load an image from file.
"""
ds = gdal.Open(fname)
return ds.ReadAsArray().astype(dtype)