[gdal-dev] Problem using RasterIO to flip image
Even Rouault
even.rouault at mines-paris.org
Fri May 27 13:23:48 EDT 2011
Le vendredi 27 mai 2011 18:46:29, Leith Bade a écrit :
> Hi,
>
> I am trying to write an image that has a y inverted buffer.
>
> I tried this:
> band->RasterIO(GF_Write, x, y, width, height, data + width * (height - 1) *
> sizeof(short),
> width, height, GDT_Int16, sizeof(short), -width * sizeof(short));
>
> But I get a segfault in memcpy.
>
> What am I doing wrong?
First I assume that your data buffer is at least width * height * sizeof(short)
large.
Then if your data variable is of type char*, it should work. If it is of type
short*, then data + width * (height - 1) * sizeof(short) is wrong. It should
be data + width * (height - 1).
>
> Thanks,
> Leith Bade
> leith at leithalweapon.geek.nz
More information about the gdal-dev
mailing list