Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Smooth curve from points?

524 views
Skip to first unread message

Bob Masta

unread,
Mar 11, 2006, 7:26:05 PM3/11/06
to
Greetings, Gimp Gurus!

I would like to be able to turn rough pencil sketches into
neat drawings. My strategy so far is to get the scanned
sketch into Gimp and convert the black pencil lines into
some pale color that black path lines will show up against,
then use Gimp to draw smooth lines on an upper layer,
using the original as a guide. This is trivial for straight
lines, but arbitrary curves are really awkward using the
Bezier tool. They are not so bad if they can be made
from a single warped line segment (handles on each end),
but for curves with any undulations it's very hard to avoid
obvious cusps at the segment joints.. There doesn't seem
to be any Gimp equivalent of a French curve!

What seems to me to be an obvious solution would be to
allow the user to set some points, and have Gimp run a
smooth curve through them. Ideally, this could be something
like a polynomial with the ability to reduce the power,
so that the drawn curve would get smoother at the cost
of maybe not passing through each and every point.

The more I think about this, the more I think that this is
so obvious that someone has surely done it already.
I have been looking through various tutorials, however,
and the Bezier tool seems to be the closest there is.
Am I missing something? Is there a plug-in out there
somewhere? Or some other approach that can accomplish
the same goal?

Many thanks!


Bob Masta
dqatechATdaqartaDOTcom

D A Q A R T A
Data AcQuisition And Real-Time Analysis
www.daqarta.com
Home of DaqGen, the FREEWARE signal generator

Michael Soibelman

unread,
Mar 11, 2006, 9:25:39 PM3/11/06
to
Bob Masta wrote:


Well....Try creating your line with the bezier tool. Then stroke the
selection using the 'stroke with a paint tool'. Use a 3x3 fuzzy brush.
That should give a pretty smooth line. Or you could stoke with the
airbrush tool.

I often create line drawings in Skencil using the Autoshapes plugin and then
export as an eps file. Then I'll load this into Gimp. If the edges are
too rough I'll select the line(s), select to path, stroke path with one of
the fuzzy brushes. Easy way to create line drawings. Often I'll use the
blend function in Skencil to create nifty drawings.

There is the Gimp 'shape paths' plug in for generating shapes as well as
Gfig, but neither of these has the power and flexibility of Skencil for
creating line drawings easily.

Just My 2cents worth.

Michael Soibelman

unread,
Mar 11, 2006, 10:07:18 PM3/11/06
to
Bob Masta wrote:


Here's another answer. When you create curves using the bezier tool you can
change mode from create to edit and select a point(s) click on it and
adjust the handle(s) to smooth out the curve....In case you are unaware of
that.

Bob Masta

unread,
Mar 12, 2006, 8:34:01 AM3/12/06
to
On Sun, 12 Mar 2006 03:07:18 GMT, Michael Soibelman
<no-...@sbcglobal.net> wrote:


>
>Here's another answer. When you create curves using the bezier tool you can
>change mode from create to edit and select a point(s) click on it and
>adjust the handle(s) to smooth out the curve....In case you are unaware of
>that.

Yes, but that doesn't address my issue: It requires a fair amount
of fiddling with the handles of each point, when what is really wanted
is to draw a smooth curve in the first place. I see this as the same
problem as drawing a "best fit" curve through plotted data on a graph.
It's such a well-explored subject for data analysis, it would be
surprising if nobody had tried it for graphics. Or maybe they have,
and there is some complication I haven't considered?

Best regards,

Michael Soibelman

unread,
Mar 12, 2006, 1:08:05 PM3/12/06
to
Bob Masta wrote:

Probably some guru out there has a better answer for you than I.
This sounds like some sort of mathematical formula for smoothing curves that
you are looking for. Can you provide an example to us so that we may try
to see what your dealing with ?? Often this allows for a better treatment
of your situation. And, yes, your correct in your statement that this has
been dealt with in other areas.

Bob Masta

unread,
Mar 13, 2006, 8:25:37 AM3/13/06
to

I don't have a specific example on the Web. I'm just drawing pencil
sketches and trying to clean them up into smooth line drawings.
(The situation would be even worse if trying to sketch with a mouse.)
This is a little different than the usual selection process, since I
specifically do *not* want a faithful copy of the original lines, but
rather a smoothed version.

I suspect everyone has run into this issue when trying freehand
mouse drawing, and probably responded (as I have in the past)
by trying to "construct" the image instead of sketching it. But
you could probably create an example by freehand drawing
a face or something that has complex curves. Maybe fancy
calligraphy would be a good example.

I'm thinking that there might be workaround by some process
that involves blurring the original lines, so as to get rid of the
little feathers and jags of freehand lines, and then using some
selection method to "aim down the middle" of the blur. But
I haven't tried anything like that yet.

Thanks and best regards,

Doctor J. Frink

unread,
Mar 13, 2006, 11:24:44 AM3/13/06
to
On Mon, 13 Mar 2006 13:25:37 GMT, Bob Masta <NoS...@daqarta.com> wrote:
>
>I don't have a specific example on the Web. I'm just drawing pencil
>sketches and trying to clean them up into smooth line drawings.
>(The situation would be even worse if trying to sketch with a mouse.)
>This is a little different than the usual selection process, since I
>specifically do *not* want a faithful copy of the original lines, but
>rather a smoothed version.

Have you tried converting the sketches into a vector format using
autotrace?

http://autotrace.sourceforge.net/

I've used it a few times to take in rough sketches (that I've found on
the internet) and get a smooth vector output that I can then scale up to
much higher resolutions for loading into gimp.

Frink

--
Doctor J. Frink : 'Rampant Ribald Ringtail'
See his mind here : http://www.cmp.liv.ac.uk/frink/
Annoy his mind here : pjf at cmp dot liv dot ack dot ook
"No sir, I didn't like it!" - Mr Horse

Marc 'BlackJack' Rintsch

unread,
Mar 13, 2006, 3:44:13 PM3/13/06
to
In <4413662...@news.itd.umich.edu>, Bob Masta wrote:

> I would like to be able to turn rough pencil sketches into
> neat drawings. My strategy so far is to get the scanned
> sketch into Gimp and convert the black pencil lines into
> some pale color that black path lines will show up against,
> then use Gimp to draw smooth lines on an upper layer,
> using the original as a guide. This is trivial for straight
> lines, but arbitrary curves are really awkward using the
> Bezier tool. They are not so bad if they can be made
> from a single warped line segment (handles on each end),
> but for curves with any undulations it's very hard to avoid
> obvious cusps at the segment joints.. There doesn't seem
> to be any Gimp equivalent of a French curve!

Maybe a vector based program like Inkscape_ is better for this task. Gimp
is very good at pixel manipulation but a bit limited when it comes to
vector graphics.

Another approach to get black ink lines from pencil sketches is:

1. Scan at high resulution.
2. Use the curves tool or threshold to convert to black & white leaving
just the "main lines" and removing not so strong help lines and guides
from the image.
3. Blur the image.
4. Scale down to desired size.
5. Use curves tool to sharpen the black lines again.

This way you get something that looks more like an ink drawing like in
comic books while the bézier curves approach looks more like a technical
drawing with strokes that are all the same width.

.. _Inkscape: http://www.inkscape.org/

Ciao,
Marc 'BlackJack' Rintsch

stus...@hotmail.com

unread,
Mar 14, 2006, 7:27:26 PM3/14/06
to
Hi Bob - What you're asking about is often done using a "tracing"
program. With Linux, the two big trace programs are "Potrace"
and "Autotrace", where earlier versions of Gimp offered an Autotrace
plugin called "Frontline"... I haven't seen this in recent
distributions.

Take a look at Potrace or Autotrace/Frontline on the web, and
see if this isn't more or less what you're trying to do.

http://potrace.sourceforge.net/#example

Also... posting an example drawing is always a good way to get
more specific answers.

Bob Masta

unread,
Mar 15, 2006, 8:27:35 AM3/15/06
to
On 13 Mar 2006 16:24:44 GMT, fr...@homer.cmp.liv.ac.uk (Doctor J.
Frink) wrote:

>On Mon, 13 Mar 2006 13:25:37 GMT, Bob Masta <NoS...@daqarta.com> wrote:
>>
>>I don't have a specific example on the Web. I'm just drawing pencil
>>sketches and trying to clean them up into smooth line drawings.
>>(The situation would be even worse if trying to sketch with a mouse.)
>>This is a little different than the usual selection process, since I
>>specifically do *not* want a faithful copy of the original lines, but
>>rather a smoothed version.
>
>Have you tried converting the sketches into a vector format using
>autotrace?
>
>http://autotrace.sourceforge.net/
>
>I've used it a few times to take in rough sketches (that I've found on
>the internet) and get a smooth vector output that I can then scale up to
>much higher resolutions for loading into gimp.
>
>Frink
>--

Thanks for this tip! I looked at the examples at that
link and was very impressed. However, the task they
were doing is not really the same as what I want. They
start with nice, smooth characters and yes, they get
nice, smooth vector tracings back. This is great, but
I think Gimp already can do a good job using the Magic
Wand or something. The thing I want is to smooth out
rough lines, which I gather you were able to do with
your sketches. Does autotrace give some control over
how closely it follows the original versus smoothing out
curves? My previous experience with raster-to-vector
options in a CAD context was not very satisfying: You
could only get more or less points on the final line, all
connected with straight segments. If you used fewer points
to capture the basic shape without the sketchiness, then
you endedup with a polygon instead of a curve. If you
used more points, they followed every little jag and blip...
and they still were connected by line segments.

Anyway, I'm eager to give Autotrace a chance, since
my need seems to be the same as yours. But one
thing I'm wondering about: The executable download
(for Windows) says something about a particular C++ compiler.
Do you know if it expects to find something (DLLs?) already
on my system?

Thanks, and best regards,

Bob Masta

unread,
Mar 15, 2006, 8:35:34 AM3/15/06
to

Thanks, I have looked at the Potrace example and was
very impressed... looks like exactly what I need!
I snagged the Win32 download just now, and will report
back after I've given it a try.

The reason I have hesitated providing an example is
because the concept is general. I wasn't looking
for an ad-hoc solution for any particular case, but
a general approach for sketch-to-Gimp. Looks like
Potrace (or Autotrace, etc) may be the ticket.

Thanks again!

Doctor J. Frink

unread,
Mar 15, 2006, 8:51:02 AM3/15/06
to
On Wed, 15 Mar 2006 13:27:35 GMT, Bob Masta <NoS...@daqarta.com> wrote:
>
>Thanks for this tip! I looked at the examples at that
>link and was very impressed. However, the task they
>were doing is not really the same as what I want. They
>start with nice, smooth characters and yes, they get
>nice, smooth vector tracings back. This is great, but
>I think Gimp already can do a good job using the Magic
>Wand or something. The thing I want is to smooth out
>rough lines, which I gather you were able to do with
>your sketches. Does autotrace give some control over
>how closely it follows the original versus smoothing out
>curves?

Yes, you can alter the filter-iterations setting. Autotrace smooths
curves before fitting, between 0 times (ie no smoothing) to as many
times as you want.

I found I got better results by loading the original into gimp and using
levels to get the blacks black and the whites white (similar to the edge
mask in this tutorial http://gimpguru.org/Tutorials/SmartSharpening2/ )
so autotrace gets a better idea of what's a line and what isn't.

0 new messages