Image affine transform code