Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Smoothing a path: a simple plugin
#1
I happened to find a simple algorithm to smooth paths of linear line segments. The site is

https://web.archive.org/web/201903270015...ERPOLATION

The algorithm is a simple geometric construction of control points. Certainly there are much more sophisticated algorithms but this is simple and probably sufficient to most purposes. I made a faithful implementation of it. (I manipulated the formulas a little which gave different insight to their meaning. But I refrain from explaining it here.)

To get the plugin, go to

http://kmarkku.arkku.net/Path_modify_fil...aster.html

scroll to the bottom, and click the right download button ("Simple smooth"). You get a zip file. Unzip it and place the one file it contains (simple_smooth_path.py) in your user's plug-ins folder. Then (re)start Gimp. To use the plugin: in the Paths tab, right-click a path and follow the links Tools > Modify path > Simple smooth.

A picture tells all:

   

This was done with default values. Note that the smoothed path passes through all anchors of the original path. In fact, all anchors are preserved (with one exception, see below) and no new anchors are created; only new handles are made. So the plugin works differently from my recent corners-rounding plugin. To compare the two plugins, look at this:

   

In

https://www.gimp-forum.net/Thread-Roundi...6#pid23626

Rich recalled some old smoothing plugin. By my experiments the effect differs slightly from that of my simple plugin. I guess it uses some more sophisticated algorithm. This new simple plugin uses a simple local geometric construction, and it, for instance, makes no effort to minimize the deviation of the smoothed path from the original one.

Some words about the new plugin:

The GUI asks for 'strength'. Default is 1. Smaller values give tighter bends. There is also an option on how to use the selection: with it you can restrict the effect to a smaller part of the path.

The only option that needs explaining is that the plugin asks "Remove superfluous anchors from straight edges?" Default is "Yes". An example: Suppose you make a rectangular selection, rotate it, and apply "Selection to path". You get something like on the left, with lots of anchors:

   

If you apply here the plugin without removing the superfluous anchors you get what you probably were not after. Namely, all anchors are preserved and the result is not good. But if you keep the default value "Yes" you get what is seen on the right. That is what probably was wanted. Only 4 anchors are kept.

By the way, I had some problems with this option. I fear it may cause trouble in some cases. If so, please tell me and I shall see what I can do.
Reply


Messages In This Thread
Smoothing a path: a simple plugin - by Ottia Tuota - 06-06-2021, 10:50 AM
RE: Smoothing a path: a simple plugin - by Ofnuts - 06-24-2021, 05:18 PM
RE: Smoothing a path: a simple plugin - by Krikor - 11-16-2021, 05:12 PM

Forum Jump: