Added support for images whose last dimension is odd. This is more expensive computationally, and it costs more in memory, but it's optional.