gdal_plugin.py 349 B

1234567891011121314151617
  1. __all__ = ['imread']
  2. try:
  3. import osgeo.gdal as gdal
  4. except ImportError:
  5. raise ImportError(
  6. "The GDAL Library could not be found. "
  7. "Please refer to http://www.gdal.org/ "
  8. "for further instructions."
  9. )
  10. def imread(fname):
  11. """Load an image from file."""
  12. ds = gdal.Open(fname)
  13. return ds.ReadAsArray()