corrected bug for non-quadratic images

incorrect handling of x/y dimensions in case of non-quadratic arrays