2

For a given image, I want to move pixels by 'pinching' the image without changing the actual size of the image. A good example can be seen in this answer.

enter image description here

See this example image above, from the answer linked above. Here pixels around the center are pulled towards the center. Thus, the deformation of the image is based on a circle. In other words, pixels on the left of the center are pulled towards the right, pixels above the center are pulled down and pixels top-left of the circle will be pulled in a down-right direction.

My desired outcome is to pinch the image pixels only in one direction. Thus, instead of pixels being pulled towards the center of a circle, I would want pixels to be pulled towards a horizontal (or vertical) line. Pixels above the horizontal line are pulled down, pixels below will be pulled up.

I expect I could create the desired outcome by iteratively using a circle pinch across every column of the image and taking the column that has the circle center, but this seems very in-efficient.

Any python library that can achieve this would be acceptable.

Christoph Rackwitz
  • 11,317
  • 4
  • 27
  • 36
Mitchell van Zuylen
  • 3,905
  • 4
  • 27
  • 64
  • answer in link uses [Wand](https://docs.wand-py.org/en/0.6.0/wand/image.html) and maybe it has other method which can work as you expect. Often deformation could be created using some mask/matrix with information how far move pixel - and maybe it has function to use own matrix for this. – furas May 31 '22 at 02:00

0 Answers0