2

I am new to Gimp. I would like to warp an image such that it fills the closed path (closed path and imported image is shown in the image below). The given closed path has a shape of truncated pie. The outer diameter of truncated pie is 15 units and inner diameter of it is 5 units, and the angle of that pie is 60 degrees. Before

The result should be something like image below (created on photopea.com).

After

Can I achieve this in Gimp?

  • 1
  • @Scott... yes, but there I was looking solution using Adobe products. In this question I am looking solution using Inkscape (open source). I don't know if I should have edited the same question. – Nimish Jain Oct 4 at 19:44
  • You have already got how the job could be done in Illustrator and how in Photoshop. I guess you tagged the previous question with Photoshop and Illustrator to get some attention, but the given methods unfortunately cannot be used in Inkscape nor Photopea. I guess your remaining problem is the missing access to Adobe's programs and any low cost or freeware solution would be welcome. Right? – user287001 Oct 4 at 21:15
  • 2
    The problem is that Inkscape is a vector graphics editor. It's not going to be able to do this. I would recommend Gimp instead, e.g. docs.gimp.org/2.10/en/plug-in-curve-bend.html – Moini Oct 4 at 23:57
  • 1
    As @Moini has pointed out, I will explore Gimp instead. – Nimish Jain Oct 5 at 2:18
4

Using Filter>Distorts>Polar coordinates

I assume the real goal is to map the image to a sector, and that the path is not really necessary.

If we apply the Polar coordinates filter to a square image:

enter image description here

We get this:

enter image description here

  • The final image is the same size as the initial image
  • The whole image is wrapped on a full circle (360°)
  • The height of the image is mapped on a radius, so everything is shrunk by a factor of two
  • The width of the image is mapped on a circumference. Things at the top are shrunk to zero, things at the bottom are widened by Pi, and things in the middle are widened by Pi/2. So, if we want a 60° sector:

  • We scale the image by 2 vertically, and by 2/Pi horizontally. Our 400x400 image becomes a 255*800 image:

enter image description here

  • Since 60° is one sixth of a circle we scale the canvas to 6x the width, while keeping it square: 1530x1530 and center the image layer in it (for display purpose the image is scaled down, and transparency replaced by black, but this is not part of the process):

enter image description here

  • The layer is made as big as the canvas:
    • To ensure it is filled with transparency: Layer>Transparency>Add alpha channel
    • Then Layer>Layer to image size
  • And we apply the Polar coordinates (for display purpose the image is scaled down, and transparency replaced by black, but this is not part of the process):

enter image description here

From which we can extract the part of interest: Image>Zealous crop

enter image description here

  • +1 I like this solution. It's so mathematical it scares me! Thanks for sharing. – Billy Kerr Oct 5 at 23:30
  • 1
    @BillyKerr Come on, nothing worse than cross-multiplications... – xenoid Oct 6 at 0:06
  • I should've paid more attention in maths class LOL;) – Billy Kerr Oct 6 at 0:54
  • @xenoid, I got the concept. Thank you very much for providing such an accurate solution. Now I can apply it to image of any size. – Nimish Jain Oct 6 at 13:33
  • @xenoid, after applying 'Zealous crop', I am still getting the black color in the background. Do I need to add alpha channel, use the free select, invert and delete the unwanted part? – Nimish Jain Oct 6 at 17:33
2

As far as I know, in GIMP this would require some manual work. There's no automatic arc distort tool. So if you're up for that, it's entirely possible. Unfortunately the Curve Bend filter in GIMP is difficult to use if you want some accuracy.

In GIMP use the shape you made as a guide. Set this image as the top layer, and set the blending mode to "Multiply" in the layers panel. Under that layer, put the image you want to distort, and under that a white filled background layer.

  1. Select the image layer, and press Shift+T to do a unified transform.

  2. Double click and drag the corner handles to distort the image to the corners of the guide layer.

enter image description here

  1. Press Enter to confirm the transform.

  2. In the main menu click Layer > Layer to image size

  3. Select the Warp Transform Tool W in the tool box

  4. Adjust the size of the tool in the tool options until it is larger than the image.

  5. Click and drag with the tool, a little at a time, to make the image curve to approximately the curvature of the shape. It's a little tricky and will require some trial and error

  6. Set the tool size smaller and click and drag with the tool to get it to match the shape as close as possible.

I've sped this up to keep the animation file size small enough to upload here, but it may take some time to get it right. I am sure you could make a better job of it than me, with a little more time and care.

enter image description here

  • I really appreciate the effort you have put in to provide the solution. – Nimish Jain Oct 6 at 13:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.