Python 3 Sci-kit Library Script to Cartoonify & Draw Pencil Sketch of Image File Using NumPy
344 views
Jun 3, 2025
Get the full source code of application here: https://codingshiksha.com/python/python-3-sci-kit-library-script-to-cartoonify-draw-pencil-sketch-of-image-file-using-numpy/
View Video Transcript
0:00
uh hello guys uh welcome to this video
0:02
so in this video I will show you one
0:04
other Python package which can actually
0:07
generate a pencil sketch or cartoonify
0:10
your input image you can generate a
0:12
cartoon version of your image completely
0:15
free so let me first of all show you an
0:18
example right here so we take an input
0:21
image like this you will see this is our
0:23
input image we are taking and now we
0:26
just need to generate a cartoon version
0:27
or a pencil sketch of this so once I
0:30
execute this Python script it will
0:33
create a new file which will be a
0:37
sketch darken
0:40
jpg
0:42
so let me just take a different image
0:46
for example
1:01
so what can I do i can ask chat GPT for
1:04
this because our output is not looking
1:08
good so what I can do I can paste this
1:19
in i've given the script in the
1:22
description so chat GPT you can see it
1:24
will tell you what is the issue that
1:26
you're facing the output is image being
1:29
completely white so it will suggest some
1:32
fixes and then you can apply these fixes
1:36
to just copy this
1:39
so again try
1:44
this so so now you can see it will
1:46
generate your pencil sketch
1:48
successfully so I have given this source
1:52
code I will update this source
1:54
code so again let me take a different
1:57
image for example so in this way you can
1:59
see chat GPT
2:01
will is a very useful tool in terms of
2:04
coding because it can correct the
2:07
mistakes and you can see so in this way
2:10
you can generate this uh very simply
2:13
this pencil sketches it looks really
2:15
cool you will see it's a drawing pencil
2:18
sketch or
2:20
a it changes to cartoon version of the
2:24
image so now let me show you step by
2:26
step how it is built so first of all you
2:30
need two modules for this first of
2:33
all you need if you go to the Python
2:38
website just search for
2:43
this sky kit I think
2:48
yes
2:50
SCI
2:55
get so you need this one and the second
2:58
one is numpy
3:04
so so after this you need to simply
3:09
import
3:11
this these two libraries which
3:16
are like this after that we specify the
3:20
input
3:30
image and then we convert this into uh
3:33
grayscale image which is black and white
3:35
version using this
3:39
function and then we will apply this
3:42
filter which is the soil soel filter
3:47
after that we will invert this
3:49
image like
3:52
this the numpy package and then we'll
3:56
converting this to 8 bit the darken
4:02
version so that's all so this is the
4:05
overall script that's all that is
4:07
required here let me delete this and
4:09
rerun this you will once again it will
4:12
generate the pencil version of this
4:14
image
4:23
so I have given the script guys in the
4:25
description of this video so you can
4:31
actually use this to generate these
4:34
pencil sketches and thank you very much
4:36
for watching this video and also check
4:38
out my website freemediatools.com
4:40
uh which contains thousands of tools
#Animated Films
#Clip Art & Animated GIFs
#Photographic & Digital Arts
#Scripting Languages
#Visual Art & Design