Hi, 2010/1/19 Roger André <ran...@gmail.com>
> Assuming that I have an 8bit, paletted image named "foo.png", if I wanted > to extract a 50 x 50 pixel tile that had it's origin at pixel coords (0,0), > I would do something like this: > > in_ds = gdal.Open('foo.png') > band = dataset.GetRasterBand(1) > tile_data = band.ReadRaster( 0, 0, 50, 50, 2500, 1, GDT_Byte ) > > and then I would imagine I have to create the output dataset and write > tile_data to it. > Couldn't you just use tile_data = band.ReadAsArray()[0:51, 0:51] or even simpler (if it's an RGBA PNG) g = gdal.Open("foo.png") T = g.ReadAsArray () [:, 0:50, 0:50 ] T.shape is now (4, 50, 50) ? J
_______________________________________________ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev