I am using python 2.7 and have gdal installed. I want to read an entire .jpg image at once and so I used statement
import gdal
from gdalconst import *
driver = gdal.GetDriverByName('JPEG')
driver.Register()
dataset = gdal.Open('1.jpg', GA_ReadOnly)
but I am getting an import error for gdal_array.
ImportError Traceback (most recent call last)
<ipython-input-7-6a16047a395b> in <module>()
----> 1 data = band.ReadAsArray(0, 0, cols, rows)
C:\Users\DELL\Anaconda\lib\site-packages\osgeo\gdal.pyc in ReadAsArray(self, xoff, yoff, win_xsize, win_ysize, buf_xsize, buf_ysize, buf_obj)
1174 def ReadAsArray(self, xoff=0, yoff=0, win_xsize=None, win_ysize=None,
1175 buf_xsize=None, buf_ysize=None, buf_obj=None):
-> 1176 import gdalnumeric
1177
1178 return gdalnumeric.BandReadAsArray( self, xoff, yoff,
C:\Users\DELL\Anaconda\lib\site-packages\osgeo\gdalnumeric.py in <module>()
----> 1 from gdal_array import *
2 from numpy import *
C:\Users\DELL\Anaconda\lib\site-packages\osgeo\gdal_array.py in <module>()
24 fp.close()
25 return _mod
---> 26 _gdal_array = swig_import_helper()
27 del swig_import_helper
28 else:
C:\Users\DELL\Anaconda\lib\site-packages\osgeo\gdal_array.py in swig_import_helper()
16 fp, pathname, description = imp.find_module('_gdal_array', [dirname(__file__)])
17 except ImportError:
---> 18 import _gdal_array
19 return _gdal_array
20 if fp is not None:
ImportError: No module named _gdal_array
Please tell me what could possible be going wrong. I am new to using GDAL.