Gmic line-art colorization

image data/images/blog/2014/09/thumb.jpg

Introduction :

This is an article dedicated to the Gmic filter 'colorize', a new and next generation computer-assisted tool for colorization image filter.

This filter was created by David Tschumperlé , project manager and main developer of Gmic.

The filter improved a lot on this September 2014 ( and was started around spring 2013 ). I kept an eye on the filter development since the very beginning as a tester, but I got totally enthusiast about it recently ; especially when filter became interactive and more user friendly.

I ) Overview

1) What kind of problems it solves :

A bit of context here, the first steps of colorizing a line-art, usually with flat zone is a super long, annoying and robotic work.

How artist usually handle this task :
- Brush : simply take a brush and fill manually the color (a.)
- Fill Bucket : use a fill bucket tool and click the area, then correct with brush (b.)
- Of course, both methods (often used together) introduce quality problems (c.)

A lot of artist find with time their own recipes to reduce this step. Also digital-painting software proposes set of features to make the life of artist less difficult : auto-enlarge fill bucket result, gap detection for fill bucket, better selection tools, filter to fill every zones with random colors ...etc...

Here I'm used to the brush method (a.). It's might not look obvious on the size of the little 'grumpy unicorn drawing' here, but I'm sure you can imagine the long time it represents repeating this on a lot of comic pages. Not surprising that even on the comic industry, 'preparing page with flat color zone' is even a job, and a full-time-working position.

2) Gmic filter solution :

Gmic 'colorize' filter works a bit like a smart fill bucket tools on steroïd , it's really interactive, and the previous boring task with bad results become suddenly a fun part of the job with a clean result.

How it works :
  - Feed Gmic with a lineart ( eg. a b&w picture ) 
  - Select colors and place color markers/tokens on the picture ( you can move them or delete them too )
  - At any moment press <Space> to update the rendering and gmic will smartly fill the colors detecting edges (d.)
  - Place more markers until the result is good and keep press <space> to update.
  - Press Enter at the end ; Gmic will export a color map image as a result. (e.)

Note : Gmic fills the gaps and don't care if the line are transparent, or sketchy.  It's very fast to do.

3) The result :

In Krita ( my favorite digital-painting software ) open your line-art and import your color map ( drag and drop the file over the canvas, or in Menu>Layer>New>Import Layer ); put your line-art on the top of your layer stack with the 'multiply' mode to test (f.) . You might be amazed by how the color-map is exact and clean ; even under transparent line-art (g.).

For sure, you 'll meet minor issue here and there and will need to clean parts manually sometime, but the bigger part of the work is done for setting your flat zones, and it's done , again, very fast .

II ) Real example inside a workflow :

In the upcoming Pepper&Carrot ep.3, an open webcomic I'm writing, I use the colorize filter to prepare my comic pages.

1) Setting area with clean edges

I don't use the filter 'colorize' to color all the little details. The filter is able to do this for sure, but for my usage I prefer to use it to obtain large groups of the same color.

click to enlarge

2) Import in Krita

I reinject the colormap obtained by Gmic in my Krita *.kra files, and correct the areas if necessary. In this case, I had a glitch only on her hair ( still visible on the screenshot ) ; easy to correct.

click to enlarge

3) Painting within the limits of selected areas

Real fun start here; I keep the layer with Gmic result on the bottom of my stack and use it as a color-selector layer ; I use "magic wand" on it to select area of colors. Within this selections, I can paint freely while keeping really clean edges. It's really convenient for my style, because I like soft shading, and not shading with only hard edges as often used on comic, cartoon and anime.  

click to enlarge

4) Post-production effects

I add a color-grading pass using often the adjustment curves, color-balance, and contrast/brightness curve.
Final touch is to texture my result for the watercolor effect.

click to enlarge

III ) Install notes :

This filter is very recent in September 2014 and still beta.
Package for mac, windows and Linux are available here on sourceforge on the sourceforge of the Gmic project.
If you have already a version of Gmic better than 1.6.1 , then you don't need to install anything. Just refresh the filter database.
This installation will install the gimp_gmic plugin as well.

notes for 'buntu Linux 14.04 , 64bit:

You'll need libtiff4_3.9.7-2ubuntu1_amd64.deb , required dependencie, available here  (from older repo).
I installed gmic_1.6.*_beta_amd64.deb available here on sourceforge.

IV ) Usage via Gimp-Gmic plugin

You'll need Gimp 2.8 installed, and the Gmic beta plugin.

1. Open

Open with Gimp your Line art

click to enlarge

2. Call the Gmic filter dialog

The filter can be found on regular installation under the menu Filters > G'MIC

click to enlarge

3. Find and setup the filter

Note : refresh your filter database ( press the button of a circular arrow at the bottom of the 'Available filters' list. it's between a '+' button to add the filter to your favorites, and a checkbox with 'internet' label, to benefit from the additional Internet filters update )
This is the harder part ; Select under the categories 'Black&White' (1.) the filter 'Colorize[interactive]' (2.)  ; then on the right side, setup (3.) :
- Input type : Lineart  ( we choose 'Lineart' here , exept if you want to recolorize an old black&white photo )
- Output type : Original image + color-only layer  ( to get two resulting layers )
- View resolution : Choose a setting depending your hardware performance , this will affect the preview refresh time, and preview quality.
- Palettes : optionnal ; select on disk a palette ( *.gpl format )
Then when ready, press Ok (4.)

click to enlarge

4. Gmic colorize interactive dialog

The dialog will appear on your desktop ( you'll probably need to reorganize the windows a bit to be more comfortable ).

Mini how to use :
You can start to take a color from the palette , and place your markers on the canvas
Press <space> to update the filter, do it often.
Usefull : right click on a marker to delete it ; and right-click on a color on canvas to color-pick it.
When the work is done, press <Enter>

click to enlarge

Here are all the list of the keyboard commands so far :
- Left mouse button creates a new colored control point (or moves an existing one).
- Right mouse button over a control point deletes it.
- Right mouse button anywhere else picks a color from the image.
- Mouse wheel, or keys 'CTRL+arrows UP/DOWN' zoom view in/out.
- 'CTRL+mouse wheel', 'SHIFT+mouse wheel' or arrow keys move image in zoomed view.
- Key 'SPACE' updates the extrapolated color field.
- Key 'TAB' switches between markers view modes.
- Key 'BACKSPACE' deletes the last control point added.
- Key 'PAGE UP' increases image contrast.
- Key 'PAGE DOWN' decreases image contrast.
- Keys 'CTRL+D' increase window size.
- Keys 'CTRL+C' decrease window size.
- Keys 'CTRL+R' reset window size.
- Keys 'ESC', 'Q' or 'ENTER' exit the interactive window.

5. Back in Gimp

When you press <enter> the filter will export in your Gimp layer stack 2 layers ; the original line and the color-map.
You can then place your lines on the top (1.) and set the blending mode to multiply (2.) ( or using the Color > Color to Alpha to remove the white part of the image )
Just export this as a *.ora ( open raster ) if you want to continue to work your color on Krita or Mypaint :)

click to enlarge
That's all :-)

V ) Usage : command line style :

Start to update the filter , in a terminal :
gmic -update
... to update and download all the recent filters. That's it. You have Gmic beta with last filters.

You can then launch Gmic 'colorize' filter this way :
Save your lineart in a folder ( eg. lineart.png ) and open a terminal into this folder, and copy or adapt :
gmic lineart.png -x_colorize 1,1024,1 -s c,{3-s} -o[-1] colors.png
Here is another variant if you save also in this folder a palette.gpl file to get an additional palette dialog. 
gmic linear.png -input_gpl palette.gpl -x_colorize[0] 1,1024,1,[-1] -k[0] -s c,{3-s} -o[1] colors.png
It will open a canvas with your artwork, and under or around a dialog with the palette.
The terminal will write you how to use the filter, and command to use. ( screenshot under )

a Terminal windows , after a Gmic colorize filter done from command line

That's it, have a good coloring time

VI ) Usage : video demo

Here is a demo video, by David Tschumperlé over a Pepper&Carrot line-art :-)

Conclusion :

I saw so many comic artist compromising their own line-art style by making all the area closed, all the lines pure black, etc... What's the meaning of all of that ? optimize the artwork to use non efficient tools as the fill-bucket? Yes. Most of line-art artworks are still under the slavery of outdated tools constrains. And most artist prefer change their own style for something more synthetic, robotic and predictable in order to win a bunch of painful hours of work. I don't blame, and I totally understand as I tried myself during many years to ink this way, to optimize my own workflow to make the fill-bucket tool easier to use. But I couldn't use pure black lines, use only big simple shapes and close all my line gaps ; I like the feeling to ink my comics with pencil , and my lines are full of grays shades, and I don't close always my lines and shapes. I even like to crosshatch a bit, and detail texture with messy lines here and there. A nightmare to colorize...

But a filter like the Gmic 'colorize' is really bringing on the table an innovating answer to the problem. This will really improve my productivity, and the quality of my artworks as I can now invest more time on the shading and post-production. I even think it will help me to make more spontaneous pencil artworks, get more relax and ink more freely ; because I know they'll be simple to color...

Next step ? Getting this directly plugged into the filter menu of Krita ? :-)  

Many thanks to David Tschumperlé for all his work on Gmic,
and many thanks to Timothée GIET too for all the test he also made of this very cool tool.

License :

This article and example ( including Pepper&Carrot artworks ) is licensed under a Creative Commons Attribution 3.0 Unported License.

This tutorial is indirectly sponsored by my Patreons.  Join them if you want to support me into the creation of free webcomics, free tutorials with cool license :-)

Creative Commons License


  Dandy - Reply

Great article! This filter looks really useful, and I didn't know about it before now. Also your explanation is really clear and easy to follow. Thank you!

  dtschump - Reply

Thanks David for all the testing you have done.
Some news about this filter : it will be available today directly in the G'MIC plug-in for GIMP as well, so people will be able to use it more easily (control points will be kept in memory and editable, even after the final color calculation has been done, and you will be able also to work on selections, which is convenient for full pages). Still a lot of work to do, but I'm almost done for a first usable version.

  Boudewijn Rempt - Reply

The development version of Krita already comes with g'mic 1.6. There's no support for interactively setting the points, though. Right now Lukas is working on showing a preview for g'mic filters; I guess that integrating the user interaction would be a nice next step.

  David REVOY OP , - Reply

@Dandy : Thanks !

@dtschump : Oh, good news ; when it will be ready, I'll update the article with the screenshot of the GUI version :)

@Boudewijn Rempt : This is also a super good news. Thanks ! ( Preview of filters for Gmic in Krita ), I use Gimp only to run Gmic nowaday ( and for other little specific task I rarely do ; Gif anim / Animated brush / proof opening tiff or psd ). I really like the color-grading tools in Gmic ; CMYK[Mixer] , LaB[Mixer] , Color-grading, Film Emulations, Boost Chromacity, Color temperature, Vignette frame.

  nylnook - Reply

Great work David, David and Thimothée !

I was testing this without success last friday because I missed a good manual, thanks a lot for this one, right on time !

Maybe one additional tool may be useful IMHO : a color picking tool, to select a color from a reference image (I know we can create a palette from an image, but it would be quickier, avoiding an additional step)... In my current work, it would be great.

In any way, it will save a lot of time... Thanks again !

  David REVOY OP , - Reply

@nylnook : Hey Camille, good feedback and ideas, thanks.

  Egberto - Reply

Is time to learn new things ...

This is a good and interesting plugin, thanks for the info.

  debol - Reply

Hello david
Cela fait plusieurs fois que je lis des tutos de vous. Vraiment, à chaque fois, j'apprends quelque chose d'interessant et d'exploitable. Mille fois merci de prendre le temps de présenter ces travaux avec tant de clarté et de pédagogie. Je connaissais (superficielement) ce pugin mais là vraiment quel gain de temps!
Encore merci.

  nylnook - Reply

I opened a bug report here, but I'm not sure it the right place :

Thanks again !

  Tharinda Divakara - Reply

It's fantastic ! thank you David!. We're waiting for another tut.

  Senlin - Reply

Thanks,Very detailed tutorial!
Also look forward to full screen eyedropper tool ^_^

  julien - Reply

Le travail est extraordinaire.
une question: quelle est la police utilisée pour la redaction des bulles?

  David REVOY OP , - Reply

@all : Hey, thanks for the feedback !

@julien : La font est 'Lavi' . Elle est disponible sur Dafont ; et bien sur open-source et libre d'utilisation :-)

  Boudewijn Rempt - Reply

And Krita now has a new plugin to split up the g'mic generated colormap into separate, alpha-locked layers :-)

  David REVOY OP , - Reply

@Boudewijn Rempt : oh .... ! ! ! MANY THANKS !
/me will compile it asap ; … 7ce65b7ecb

  jahjahgone - Reply

First of all: Thanx for this great tutorial, just absolutely awsome.
I use Win7 64bit and Gimp 2.8 with GPS and I have the problem that just this one filter (colorize[interactive]) of g'mic (tried 64 bit and 32 bit version) does not work and causes the plugin to crash. Has anyone else experinced this/knows a solution?

  David REVOY OP , - Reply

@jahjahgone : Thanks! unfortunately, I'm not using Windows ( only Linux ) and I don't know a lot about this operating system. Be sure your Gmic version is updated and good luck.

  test - Reply


  Narayaan - Reply

Nice article! I'm using it recolor some old black and whtice comics at the moment. Is there a way to keep the "markers" if you save the image and quit GIMP, to continue working on it later on?

  David REVOY OP , - Reply

@Narayaan : Oh, good usage. As far as I know this feature ( saving markers on disk ) is not existing.

  Narayaan - Reply

Hi David, thanks for your quick response! This is really an awesome filter!

I filed an bug report/improvement request in G'mic. I don't know if this is something that is even possible within a plugin like g'mic, but you never know :).

The improvemnt request can be found here:

  David REVOY OP , - Reply

@Narayaan : Good job reporting it !

  Narayaan - Reply

I don't know if this issue in G'mic ever will be fixed, but I read that the lazybrush functionality coming up in Krita should do the same thing. Might be interesting to do a comparison once it has been implemented!

  Olivier L. - Reply


J'ai une question, les fichier palettes ".gpl" se crééent ils automatiquement? J'étais parvenu à en créer un temps en utilisant Krita via Linux (et je crois me souvenir d'un menu ou l'on parametrait le nombre de couleurs, de colonnes etc...).

Je tente de faire des colorisation mais je ne vois de fichiers ".gpl" créés nulle part (je precise que j'utilise actuellement Krita sous windows 7 mais je ne pense pas que ça devrait en changer le mode de fonctionnement).

  David REVOY OP , - Reply

@Olivier L. : Bonjour, Je pense qu'il y a confusion :
- Krita, Mypaint mais surtout Gimp peuvent créer des fichier *.gpl.
- Le fichier *.gpl est seulement lu et optionnel dans GMIC.
Donc normal si GMIC ne créer pas de fichier gpl ; c'est pas sa fonction.
Par ailleurs , c'est un format de fichier très simple et c'est possible de créer la palette dans un editeur de texte.
Voici un example de fichier palette que j'utilise, il renseigne sur la syntaxe ;

  Carsten Nikiel - Reply

Hi David,
I am trying to find out which community I should contact about a small problem I have with the interactive gmic line art colorization.
Currently I am using a Surface Pro 4 with Krita on Windows 10 and I love it (both Krita and the Surface)
My concern is about the gmic plugin. As there is no right Mousebutton on the Surface Pen directly I have to LONG press the Pen to the display.
Well this is far from optimal, as a slight movement with the pen is enough to not have an effect.
I was wondering if there might be any chance to get an enhancement in that lets me press CTRL or ALT or SHIFT and use the pen to simulate the right click.
Otherwise it is increasingly difficult to move or remove any pointers.

But I am not sure if the simulation should be done in the GMic Plugin or in Krita itself?

I would be happy to write an enhancement request, if I just knew to whom.
Many thanks and best regards,

  Carsten Nikiel - Reply

Put it on the Githup Issue Tracker for G'Mic for now.
Let's see what happens.

Best regards,

  Carsten Nikiel - Reply

Wow, David has already implemented the changes in G'Mic.
Pressing X now deletes a control point and with P you can select the color.
No right mouse button required anymore.
Now I just need to find a way to ask the Krita folks to update their G'Mic plugin.

  colorize - Reply

Is there a way to use another (custom) better palette while using this filter in Gimp? This would make it easier to remember color codes..

  David REVOY OP , - Reply

@colorize : Yes, you can. The filter as a field where you can enter a path to a palette in the *.gpl format.

  Marcotonio - Reply

Hey, David!
I have been using this tool for quite a while now, thanks to you.
It is immensely helpful! I pair it up with GIMP.

But last month I've finally decided to give in to the (several months old) update warning and update GMIC.
Suddenly, my coloring started looking like this:
I've updated GIMP as well, no improvement.

There is a partial remedy for that, which is placing more dots towards the borders, but I am quite sure it used to get the job done with less clicks.

I'm sending this message to you since you are a heavy user of the plugin, I want to confirm whether it's only me before reporting bugs and whatnot.
I'll also look for a version rollback if that's the case. :(

  David REVOY OP , - Reply

Hey Marco,
Wow, that's weird. I'm not using it since a long time ( probably 4 or 5 month ) . I'm experimenting coloring more 'direct' my artworks.
I just ran a test, and here I don't see big issue; but I trust your feeling. You should show it to the project maintainer.
the mini test I just made:

  Marcotonio - Reply

Ah, yes, direct painting is truly liberating...
Sadly my project requires a more cel-shaded approach, so I'll keep digging into the issue for now!
Thanks for the prompt reply, for the quick test and HEY, for your all the work you do, really.
I just stalk you from the shadows but your philosophy is really inspiring. There's a special thanks to you on my website. Cheers! :)

  David REVOY OP , - Reply

I rarely use Gmic directly from the Gimp or Krita plugin ; I made a little script to have it on the right-click over a *.png files.
The command line I use to get the resolution I want ( to work over A4@300ppi with good precision ) :

gmic input.png -x_colorize[0] 1,2048,1,[-1] -k[0] -s c,{3-s} -o[1] output.png

  narayan - Reply

So would you now recommend using the new smart coloring filter over this one?

  David REVOY OP , - Reply

Hey, 'yes' and 'no' :
[Colorize interactive] (old one with nodes)
- Does better job with crosshatching
- Does better job with pencil line-art ( rough lines )
- Worst for color-choice
- Dangerous because the process take long, and can't be saved while in 'interactive mode' ( eg. electricity cut ), user needs to do the full process.

[Smart Coloring] (new one)
- Works better for line-art without hole, or tiny hole
- line-art with a good/pure line quality
- Use tool of the painting app for color replacement (fill tool, palette, even color adjust filters )
- User can color half-way / save / comeback after.

Write a comment

Notice : URL allowed ( auto-clickable ). Pictures URL too ( gif,jpg,png auto-displayed )


Enter image code