 <p>If the image isn't square, you can't do in-place. Even if you work in square images, the transform isn't conducive to in-place work.</p> <p>If you want to try to do things a little faster, you can try to take advantage of the row strides to make it work, but I think the best you would do is to read 4 bytes at a time in a long from the source and then write it into four consecutive rows in the dest. That should cut some of your overhead, but I wouldn't expect more than a 5% improvement.</p>