Python 3 cartooner Library Script to Cartoonify Images & Draw Pencil Sketch Using OpenCV in Terminal
390 views
Jun 3, 2025
Get the full source code of application here:
View Video Transcript
0:00
uh hello guys welcome to this video so
0:02
in this video I will show you a Python
0:04
package which can actually cartoonize
0:07
which can convert a image file into a
0:09
cartoon or it can draw a pencil sketch
0:13
of a image file so this is a very good
0:17
module so for this we are using open CV
0:20
module plus this third party package let
0:23
me show you
0:24
uh if you go to this website just search
0:27
for this package cartooner this is
0:30
actually a third party package which
0:33
will convert your photo into a
0:34
cartoon-like image uh the command is
0:38
simple you simply install this package
0:40
apart from that you also need the open
0:43
cv package which is a very popular
0:45
package inside Python so the command is
0:48
simple you simply install this package
0:51
uh after that let me show you a very
0:53
simple
0:54
example how to initialize it simply
0:57
create a Python
0:59
file i will show you step by step so
1:02
first of all you need to import this
1:04
package we simply import this from from
1:07
cartooner we need to import this uh
1:11
function here which which there is this
1:14
cartoonize
1:17
so after that we also need to import the
1:19
open CV package like this and here you
1:22
just need to provide your input image so
1:25
this is present in my images directory
1:28
so then you just need to specify where
1:31
will be the output file which will be
1:33
created so we need to create it in the
1:35
same directory so let me call this as
1:38
cartoon.jpg and then we will read the
1:40
input file here using the open CV module
1:43
and it contains this function image read
1:47
and we will read the input file like
1:51
this so after reading it we will be
1:53
using this third party module which will
1:55
be cartoonize we'll simply pass this
1:59
image and then we will save this using
2:02
open CV using this method image
2:06
write the output
2:09
file so this is a very simple script
2:12
this completes the script here so we
2:14
simply import the module we open the
2:18
actual input image we use this function
2:22
that we imported and then we save the
2:24
image so let me test it
2:27
out so let me run the script here
2:32
so it will take some time and it will
2:34
convert your input image into a cartoon
2:38
so it created this image here you will
2:40
see
2:41
cartoon.jpg if I try to open this you
2:43
will see your input image has been
2:46
successfully converted into a pencil
2:48
sketch or you will say it's a
2:50
cartoon-like image this was the original
2:53
image let me show
2:55
you this was the original image now this
2:58
is actually a cartoon version of the
3:00
image so you can see it's looking good
3:03
and uh let me take a different image for
3:06
example let me take this
3:29
image uh let me run this once
3:36
again so you can see uh this library
3:39
works good by creating these cartoon-l
3:42
like images of your input images so if
3:44
you want to do this you can use this
3:46
free package inside Python you can build
3:49
out a simple web application as
3:51
well where you take the input image
3:54
create the cartoon-like image and
3:56
download this as an attachment so the
3:59
possibilities are endless you will
4:02
see so thank you very much for watching
4:04
this video and also check out my website
4:06
freemediatools.com
4:08
uh which contains thousands of tools
#Animated Films
#Cartoons
#Clip Art & Animated GIFs
#Movies
#Multimedia Software
#Online Goodies
#Online Media
#Scripting Languages
#Skins
# Themes & Wallpapers