piecewise image resize