I’ve been tearing my hair out trying to figure out how to get gimp to do a scale in the way I want. I think what I’m after is either a non-linear scale, or a trapezoid distort. I’m not sure I’m using the right terms (which makes it hard to google potential solutions), so to demonstrate I’ve knocked up a couple of images. If this is my source image:
Then this is what I want (I produced this manually to demonstrate):
I’ve tried the resize tools, but that only allows for square resizing, rather than a distorted scale like I want. The shear tool doesn’t do scaling. Cage transform bends the image so that doesn’t work either. Perspective distort is close, but affects the x position of the vertical lines which I don’t want:
I’ve also tried some of the filters but again couldn’t get any of them to produce the effect I’m after (the curve bend filter seems like it might work, but I can’t get it to produce the correct result).
I’m a fair programmer so if it needs a custom filter writing I can probably manage it if somebody could provide some tips as to what I need to do (some kind of matrix transform perhaps?)
Possible solution with a displace map:
- Create a group, with two layers:
- At the bottom a layer that expresses the max displacement wanted: a black to white gradient (gray 50% is “no change”, white and black will move things in opposite directions)
- Above, an “attenuator” layer that will slowly grade the black-to-white gradient to a plain 50% gray (we don’t want any changes on the right)
- This layer has a layer mask with a black-to-white gradient (so, on the left, the displacement mask is seen in full, while, on the right, it fades into a play gray 50%). In practice this isn’t strictly linear, but this can be compensated by using Curves to change the layer mask gradient.
Then call Filters>Map>Displace map, and give the group as a displace map for the Y coordinate.