We see here how to roll an image. That is, to shift it to the right or left without losing anything - the image effectively rolls as if the edges were joined. The same process will work in the vertical direction.
Execute the following program noting that we need to import a module belonging to PIL called ImageChops
. The Chops stands for channel operations.
# image_offset_1.py # >>>>>>>>>>>>>>> import Image import ImageChops im_1 = Image.open("/constr/pics1/canary_a.jpg") # adjust width and height to desired size dx = 200 dy = 300 im_2 = ImageChops.offset(im_1, dx, dy) im_2.save("/constr/picsx/canary_2.jpg")
18.119.163.238