In living color (sort of)

The other day I was reading some paper on “colorization by optimization” which is a technique for programmatically/algorithmically coloring grayscale images via some human hints. The geek in me couldn’t resist trying out how Mumbai Confidential would look like (since Vivek’s awesome grayscale style is uniquely suited to this approach). So I hunted for some sample code, found some and tweaked it and ran it with a sample page.

Algorithmic generation:
So I took a grayscale page from MC, with a mouse gave some color hints and ran it through the program. The algorithm works by a weighted mean of Luminance (Y) of the neighboring pixels and uses a technique of creating blended pixel sets (based on pointers taken from here) the source image and using the hint image generates the Color (Cb) and Chrominance (Cr) values. Basically “spreads” the hint colors and “smears” them across pixels.

As you can see the process is cool enough, but doesn’t yield good results. I chalk it up to my inability to demarcate areas in the base image (with a mouse).

So I tried a bit more and finally came up with something that resembled a flatted out image.

A few mins of TLC with GIMP filters with layers and I had some passable color images of the page.

After applying softglow (and fixing the sky):

Now, I am no talented artist like Vivek and this was just for the heck of it to explore a mathematical approximation of something that the artist does intuitively. Maths (especially Applied Maths) has been an interest of mine and programming is my dayjob. 🙂 Add to that, how passionate I’m about comics and this sort of thing is what makes life enjoyable.

As an aside, all of this isn’t my work. The grayscale image was drawn by Vivek and the algorithm and implementation hints came from people who have done work in this field. I just put them together and played with it a bit. 🙂

Found a GIMP plugin that implements the colorization at makes the pipeline much faster. Plugin code has a bug which manifests if first image is closed, will try to get it fixed and maybe take over the development of that plugin.

Here is another sample page after a quick pass through GIMP plug-in:

— Saurav

About Mumbai Confidential

Mumbai Confidential is a crime noir comic book series created by Saurav Mohapatra and Vivek Shinde [more…]

4 Replies to “In living color (sort of)”

  1. Pingback: Saurav Mohapatra
  2. Pingback: Saurav Mohapatra

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.