Hi all,<br><br>I&#39;d like to do some cropping based on pixel coordinates in a script I&#39;m writing.  I&#39;m familiar with using the srcwin option to gdal_translate, but have not done this using the API before.  Reading the API docs and some of the previous postings to this list, it appears that the RasterIO function is exposed in the Python API via band.ReadRaster().  I&#39;d like some confirmation that I&#39;m understanding the docs correctly.<br>



<br>Assuming that I have an 8bit, paletted image named &quot;foo.png&quot;, if I wanted to extract a 50 x 50 pixel tile that had it&#39;s origin at pixel coords (0,0), I would do something like this:<br><br>in_ds = gdal.Open(&#39;foo.png&#39;)<br>
band = dataset.GetRasterBand(1)<br>tile_data = band.ReadRaster( 0, 0, 50, 50, 2500, 1, GDT_Byte )<br><br>and then I would imagine I have to create the output dataset and write tile_data to it.<br><br>Is there a way to do specify the output dataset in such a way that it matches all the params of the input data, but just contains the smaller data area?<br>
<br>Roger<br>--<br><br><br><br><br><br>