What you are looking for is called a "Geometric Transformation".
When applied to image processing, it comes down to a re-mapping of pixel positions. In optical systems, they can be used to represent certain distortions caused by lenses. In fact, ray transfer matrices end up being applied as geometric transformations to images, since they represent exactly how is a pixel displaced from its original position as its light ray travels within an optical system.
There are two things that need a little bit more consideration with geometric transformations:
- How to express the mapping of pixels; and
- How to apply the interpolation.
Expressing the mapping of the pixels might be relatively "easy" for known distortions (as mentioned earlier) but what is depicted in the body of the question here seems to be arbitrary (?). In any case, you are going to have to somehow express the function that takes a pixel from location $x,y$ to location $x',y'$ in a way that makes sense to the problem at hand. The way that image processing software (such as Illustrator that you mention) does it, is by setting up a grid that divides the image into a set of patches. These lines can be piecewise linear or bezier curves. This "control" (in terms of a user interface element) is not exactly straightforward to build.
Interpolation is absolutely necessary here because the geometric transformation might "ask" for pixel values between known pixels. There are obvious ways out of this problem (e.g. linear interpolation) but it is very likely that you will need a different method that makes sense within your application.
In Python, geometric transformations can be handled by Scipy's
geometric_transformation(). Its use is straightforward provided that you know the input and output pixel locations.
Hope this helps.
How would I go about remapping these pixels considering I don't want singular pixels remapped but the entire areas 'pulled' in a direction.
This is what the geometric transformation does, as long as the input/output point pairs are provided.
Will interpolation work with colour in my image?
Do you have any suggestions where I could learn how to do this practically? Arbitrary can come after I've sorted this first part out!
Yes, have a look at the links i provided. From the mathematical point of view, we are talking about a series of linear transforms that map a "rectangle" to a distorted "rectangle". See the documentation of the