Mobile app version of vmapp.org
Login or Join
Sent7350415

: Gimp Non-square resize 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

@Sent7350415

Posted in: #Gimp #Perspective #Transform

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:

Original Image i67.tinypic.com/r09ll2.png
Then this is what I want (I produced this manually to demonstrate):

Desired Image i68.tinypic.com/6ibu3s.png
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:

Close, but no cigar i65.tinypic.com/t4zjpx.png
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?)

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Sent7350415

2 Comments

Sorted by latest first Latest Oldest Best

 

@Dunderdale640

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.

The result:

10% popularity Vote Up Vote Down


 

@BetL875

Although it does not fit your needs for this case, the "Perspective Transform tool" is what is used to achieve results like this - in order to simuate a 3d-space tilt of a 2D drawing.

As you had noted this far, there is no simple transform that can acheive what you want - I hope the displace hack provided in the other answer can it you, but otherwise, you'd rather try scripting the transform you want.

I yu want just a grid, a script to draw the ines directly. Otherwise, a script to perform a 1 pixel wide scale transform for each column in your image is the thing you should do.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme