@bplus
First source code has fixed. The problem was caused by an odd number of pixels in width or height. I didn't even think of that, of course, because my image has an even number of pixels in both directions.
First source code has fixed. The problem was caused by an odd number of pixels in width or height. I didn't even think of that, of course, because my image has an even number of pixels in both directions.

