It is currently Mon May 06, 2024 5:14 am


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: Turn photo to cartoon manually
PostPosted: Wed Aug 04, 2021 11:22 am  (#1) 
Offline
GimpChat Member

Joined: Apr 19, 2021
Posts: 121
Location: France
Hello, :)

Here is a very short tutorial about turning a photo into a cartoon picture manually without:
  • G'MIC "Artistic" filters,
  • plug-ins (except G'MIC "Repair" filters),
  • drawing.

(It's just what I learned during my experiments to turn photos into cartoons.)

Warning: It aims to make simple style cartoons (not to make more artistic cartoons).

You can proceed, for example, like this:
  • Reduce the image to about 700px-1000px wide or high
  • Duplicate layer
  • On bottom layer, "Colors -> Saturation (scale=1.8)"
  • On bottom layer, "Colors -> Hue-Chroma (lightness=10)"
  • On top layer, "Filters -> G'MIC-Qt -> Repair -> Smooth [NL-Means]"
  • On top layer, "Filters -> G'MIC-Qt -> Repair -> Smooth [Bilateral]"
  • On top layer, "Filters -> Edge-Detect -> Difference of Gaussians (legacy)" (uncheck "Invert" option)
  • On top layer, "Colors -> Desaturate -> Desaturate (mode=Value)"
  • On top layer, "Colors -> Invert"
  • On top layer, "Colors -> Threshold : about 210-240, 255"
  • On top layer, set "layer mode" to "multiply"
  • On top layer, "Merge down"
  • "Filters -> G'MIC-Qt -> Repair -> Smooth [Bilateral]", multiple times

The following posts explain the reasons why this method works better (according to me) than :
  • desaturing first
  • or using "Filters -> Edge-Detect -> Edge...(Sobel)"

To be continued...

_________________
Photo to cartoon : https://github.com/cl4cnam/gimp_cartoon_plugin


Share on Facebook Share on Twitter Share on Orkut Share on Digg Share on MySpace Share on Delicious Share on Technorati
Top
 Post subject: Re: Turn photo to cartoon manually
PostPosted: Thu Aug 05, 2021 6:37 am  (#2) 
Offline
GimpChat Member

Joined: Apr 19, 2021
Posts: 121
Location: France
1) The big steps

Here are the four big steps:
  • Intensify colors, that is:
    • On bottom layer, "Colors -> Saturation (scale=1.8)"
    • On bottom layer, "Colors -> Hue-Chroma (lightness=10)"
  • Stroke edges (the big part), that is:
    • On top layer, "Filters -> G'MIC-Qt -> Repair -> Smooth [NL-Means]"
    • On top layer, "Filters -> G'MIC-Qt -> Repair -> Smooth [Bilateral]"
    • On top layer, "Filters -> Edge-Detect -> Difference of Gaussians (legacy)" (uncheck "Invert" option)
    • On top layer, "Colors -> Desaturate -> Desaturate (mode=Value)"
    • On top layer, "Colors -> Invert"
    • On top layer, "Colors -> Threshold : about 210-240, 255"
  • Mix, that is:
    • On top layer, set "layer mode" to "multiply"
    • On top layer, "Merge down"
  • Flatten, that is just: "Filters -> G'MIC-Qt -> Repair -> Smooth [Bilateral]", multiple times

Attachment:
steps4.jpg
steps4.jpg [ 39.26 KiB | Viewed 4081 times ]

The very difficult step is "stroke edges".

To be continued...

_________________
Photo to cartoon : https://github.com/cl4cnam/gimp_cartoon_plugin


Top
 Post subject: Re: Turn photo to cartoon manually
PostPosted: Thu Aug 05, 2021 8:56 pm  (#3) 
Offline
Administrator
User avatar

Joined: Aug 10, 2012
Posts: 13031
Location: Native to NYC living in Arizona, Gimp 2.8 & 2.10, Win 11 PC.
Thank you cli345 for posting this tutorial.
We've added it to our Tutorial Index.


Gimp Chat Tutorial Index

_________________
Image
"A wise man learns more from a foolish question than a fool can learn from a wise answer"
Image


Top
 Post subject: Re: Turn photo to cartoon manually
PostPosted: Fri Aug 06, 2021 6:45 am  (#4) 
Offline
GimpChat Member

Joined: Apr 19, 2021
Posts: 121
Location: France
Thanks, Wallace! :)

2) The steps to "Stroke edges"

Here are the five steps to "Stroke edges":
  1. Smooth, that is:
    • On top layer, "Filters -> G'MIC-Qt -> Repair -> Smooth [NL-Means]"
    • On top layer, "Filters -> G'MIC-Qt -> Repair -> Smooth [Bilateral]"
  2. Detect edges, that is just: On top layer, "Filters -> Edge-Detect -> Difference of Gaussians (legacy)" (uncheck "Invert" option)
  3. Desaturate, that is just: On top layer, "Colors -> Desaturate -> Desaturate (mode=Value)"
  4. Invert, that is just: On top layer, "Colors -> Invert"
  5. Increase contrast, that is just: On top layer, "Colors -> Threshold : about 210-240, 255"

Attachment:
stepEdge5.jpg
stepEdge5.jpg [ 32 KiB | Viewed 4002 times ]

There are three choices to do:
  • Which smooth (I haven't understood the reason why one smooth works better than another one)
  • Which edge detection (see following posts)
  • In which order, to do the steps 2,3,4 (see following posts). There are three possibilities:
    • Detect, desaturate, invert
    • Detect, invert, desaturate
    • Desaturate, detect, invert

To be continued...

_________________
Photo to cartoon : https://github.com/cl4cnam/gimp_cartoon_plugin


Top
 Post subject: Re: Turn photo to cartoon manually
PostPosted: Sat Aug 07, 2021 8:13 am  (#5) 
Offline
GimpChat Member

Joined: Apr 19, 2021
Posts: 121
Location: France
3) "Detect, desaturate, invert"

To show that "Detect, desaturate, invert" is the best choice (in my view), here are three little experiments on the following image:
Attachment:
multiplColors.jpg
multiplColors.jpg [ 4.9 KiB | Viewed 3871 times ]

First experiment ("Desaturate, detect, invert"):
  • Desaturate the image (you choose the method yourself, try several ones), you can try:
    • Colors -> Desaturate -> Desaturate (choose the mode you want)
    • Colors -> Desaturate -> Color to Gray
  • Filters -> Edge-Detect -> Edge
  • Colors -> Invert

Second experiment ("Detect, invert, desaturate"):
  • Filters -> Edge-Detect -> Edge
  • Colors -> Invert
  • Colors -> Desaturate -> Desaturate (choose the mode you want)

Third experiment ("Detect, desaturate, invert"):
  • Filters -> Edge-Detect -> Edge
  • Colors -> Desaturate -> Desaturate (mode=Value) (compare with other modes)
  • Colors -> Invert

Have fun! :)

With which experiment do we obtain the edges more easily ?

In the first experiment, the desaturation of the image make you to lose some differences of colors. But, sometimes, limits of objects is visible as a difference of hue.

In the second experiment, some differences of colors is turned into yellow lines. But, it's difficult to find a desaturation method that turns yellow to dark gray.

The third experiment seems (to me) to give the best result. Some difference of colors is turned to blue lines. Only the "value" mode turns these to very light gray.

To be continued...

_________________
Photo to cartoon : https://github.com/cl4cnam/gimp_cartoon_plugin


Top
 Post subject: Re: Turn photo to cartoon manually
PostPosted: Sun Aug 08, 2021 3:24 pm  (#6) 
Offline
GimpChat Member

Joined: Apr 19, 2021
Posts: 121
Location: France
4) Stroke edges on the darker side

I think it's better to stroke edges on the darker side of edge locations (and not astride edge locations).

To show that, here are two little experiments on the following image:
Attachment:
smoothEye.jpg
smoothEye.jpg [ 1.88 KiB | Viewed 3837 times ]

First experiment:
  • Duplicate Layer
  • Filters -> Edge-Detect -> Edge (Sobel)
  • Colors -> Desaturate -> Desaturate (mode=Value)
  • Colors -> Invert
  • Colors -> Threshold : 170
  • Set mode to "multiply"
  • Toggle the visibility multiple times quickly (to see the effect well) (note the enlargement of dark zones)

Second experiment:
  • Duplicate Layer
  • Filters -> Edge-Detect -> Difference of Gaussians (legacy) (Radius1 = 8) (uncheck "Invert" option)
  • Colors -> Desaturate -> Desaturate (mode=Value)
  • Colors -> Invert
  • Colors -> Threshold : 232
  • Set mode to "multiply"
  • Toggle the visibility multiple times quickly (to see the effect well)

Have fun! :)

Which experiment gives the less distorted picture ?

To be continued...

_________________
Photo to cartoon : https://github.com/cl4cnam/gimp_cartoon_plugin


Top
 Post subject: Re: Turn photo to cartoon manually
PostPosted: Mon Aug 09, 2021 10:35 am  (#7) 
Offline
GimpChat Member

Joined: Apr 19, 2021
Posts: 121
Location: France
Here is the result of the first experiment:
Attachment:
smoothEyeExp1.jpg
smoothEyeExp1.jpg [ 2.95 KiB | Viewed 3812 times ]

Here is the result of the second experiment:
Attachment:
smoothEyeExp2.jpg
smoothEyeExp2.jpg [ 2.74 KiB | Viewed 3812 times ]

The difference between the two experiments was the method of edge detection (as implemented in Gimp).
  • First experiment (Sobel): strokes the edges astride the edge locations
  • Second experiment (Difference of Gaussians): strokes the edges onto the darker side of the edge locations

Stroking the edges astride enlarges dark zones of the image. This effect distorts the eyes of persons.
So, for "Comic Book" effect, I prefer stroking the edges onto the darker side.

Here are some Gimp (and G'MIC) filters that stroke astride:
  • Filters -> Edge-Detect -> Edge... (all the algorithms except Laplace),
  • Filters -> Edge-Detect -> Neon...
  • Filters -> Edge-Detect -> Sobel...
  • Filters -> Edge-Detect -> Image Gradient...
  • Filters -> G'MIC-Qt... -> Contours -> Edges
  • Filters -> G'MIC-Qt... -> Contours -> Edge
  • Filters -> G'MIC-Qt... -> Artistic -> Cartoon
  • Filters -> G'MIC-Qt... -> Artistic -> Poster Edges
  • Filters -> G'MIC-Qt... -> Testing -> Jayprich -> Jpr Line Edges
  • Filters -> G'MIC-Qt... -> Testing -> Joan Rake -> Artistic -> Neon
  • Filters -> G'MIC-Qt... -> Testing -> Joan Rake -> Contours -> Gradient Norm [JR's mod]
  • Filters -> G'MIC-Qt... -> Testing -> Naggobot -> Smooth Sketch
  • Filters -> G'MIC-Qt... -> Testing -> PhotoComix -> Color Sketch

Here are some methods that stroke onto the darker side:
  • Filters -> Edge-Detect -> Edge... (Laplace),
  • Filters -> Edge-Detect -> Laplace...,
  • Filters -> Edge-Detect -> Difference of Gaussians... (radius1 greater than radius2),
  • Filters -> Edge-Detect -> Difference of Gaussians (legacy)... (radius1 greater than radius2),
    • Duplicate layer
    • On bottom layer, "Filters -> Blur -> Gaussian Blur..."
    • On top layer, set "layer mode" to "subtract"
    • On top layer, "Merge down"
  • Filters -> Artistic -> Cartoon...
  • Filters -> G'MIC-Qt... -> Contours -> Morphological Filter (Action = Dilation - Original, size=2)
  • Filters -> G'MIC-Qt... -> Artistic -> Comic Book
  • Colors -> Tone Mapping -> Retinex... (Low, 16, 3, 0.1)

(Exception: For more artistical results, some little distortions can be needed. So, I think, in this case, it's better not to follow this tutorial!)

The tutorial is finished. :)

_________________
Photo to cartoon : https://github.com/cl4cnam/gimp_cartoon_plugin


Top
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts Attachment(s) Results of my "photo to cartoon" plugin

99

No new posts Attachment(s) Jackie Chan Cartoon Art

1

No new posts Attachment(s) Neon-Cartoon Abstract.

4

No new posts Attachment(s) turn photos into sketches

14

No new posts Attachment(s) Cartoon Portraits - Business Ladies

19



* Login  



Powered by phpBB3 © phpBB Group