[Image-SIG] pencil sketches

Mark Wendell mark.wendell at gmail.com
Mon Apr 27 15:00:32 CEST 2009

If what you mean by 'pencil sketch' is some sort of algorithmic
redrawing of an image as a series of 'strokes' that look like they
were hand-drawn, then like the Cannons said, theoretically yes, but
the challenge is this: you'll need to come up with an algorithm that
decides where each stroke goes based on some kind of 'feature
analysis' of the imagery. You might want to look for contours in the
image, for example. Then you'll need to decide, given the contours,
how and where to place lines that look like pencil strokes. This can
be done by picking pixels at random and following along a contour, or
by any number of other random or deterministic methods. You'll have to
worry about how long strokes are, what color and 'texture' they have,
how well they follow contours or other features, and a myriad other

PIL is a general-purpose imaging and drawing toolset. As such, it
doesn't do all this together for you, it just provides the low-level
calls you'd need to assemble something like this. The weakest part of
PIL, I'd imagine, is the drawing tools if you want to have a papery
texture to the pencil strokes.

In any case, this is a fun but non-trivial task. I'd recommend doing
some googling on topics like "non photorealistic rendering".


On Fri, Apr 24, 2009 at 2:40 PM, Laura & Edward Cannon
<cannon.el at gmail.com> wrote:
> Theoretically yes, easily no.
> On Wed, Apr 22, 2009 at 4:24 PM, Kevin Castiglione <kevincastiglione at gmail.com> wrote:
>> hi guys
>> i want to generate pencil sketch sort of effect on images with faces in images.
>> is it possible to do this effect in PIL?
>> thanks
>> _______________________________________________
>> Image-SIG maillist  -  Image-SIG at python.org
>> http://mail.python.org/mailman/listinfo/image-sig
> _______________________________________________
> Image-SIG maillist  -  Image-SIG at python.org
> http://mail.python.org/mailman/listinfo/image-sig

Mark Wendell
mark.wendell at gmail.com

More information about the Image-SIG mailing list