How do i transform this curved line & stretch/warp the middle of it, to make it a flat line? see 2nd pic. I chose these lines merely for simplicity, for this post only.



If your image has alpha, then using G’MIC, you could try: Testing/Reptorian/Grouped Pixel Axis-Based Shift.

1 Like

@Reptorian, thank you. I installed the GMIC plugin in GIMP & all that, But when I use “Grouped Pixel Axis-Based Shift”, it doesnt do anything to my selected image. And i checked the channel dialog & it says my photo has Alpha. I also found a solution, which is to use Cage Transformation, i’d never used it before. It does the job well. :slight_smile:

A copy of the image can be made, and marked-up with a wavy line that we want to be straight and horizontal. A script can then be run that will automatically distort the image to make the line straight and horizontal. The distortion can be applied to the marked-up copy or the original. Other scripts work with two wavy lines, which both become straight and horizontal. Or four wavy lines that become rectangles.

I show how this can be done with ImageMagick, and Windows BAT scripts. See:
Straightening horizons
Straightening two lines

1 Like

@snibgo, Thanks! Or one could just use cage transformation?

Gimp’s Cage Transformation requires the user to select points, and manually move those points until they seem to be in a straight line.

My scripts automatically transform the image so the points in a wobbly line become exactly straight.

Which tool works best for you will depend on factors not mentioned in your OP. For example:

  • You might not care if the line becomes exactly straight.

  • You might have one image to process, or a thousand.

  • You might be able to automatically find the line that needs to be straightened.

1 Like

Thank you , very helpful & interesting :slight_smile: