31 Oct 2010

I thought I would nicely document what I'm doing right now in terms of transforming a regular scan of an inked comic into a transparent image that can be added to Inkscape (or Gimp) for coloring and shading.

Step one, scan an image: I'm doing it using Image Capture in Mac OS X just because it's dead simple. I stay far far away from software provided by Canon, it's simply not worth it for my needs. Here's a capture of the process:

Image Capture in Mac OS X. The scanner is a cheap Canon LIDE 100.

Step two, open image in GIMP and Color-Threshold it: It's a bit of an unfortunate name for such great software, "Gimp", ahem, but let's put that aside for a minute. In my case I did first an Image --> Transform --> Rotate until I had it looking the right orientation. Then from the Colors menu I selected Threshold.

The Color Threshold tool

From the manual:

The Threshold tool transforms the current layer or the selection into a black and white image, where white pixels represent the pixels of the image whose Value is in the threshold range, and black pixels represent pixels with Value out of the threshold range.
So, the background is mostly slight variations around a shade of white, and ink is slight variations around shades of black. What we want is to end up with an almost pure white background.

Option 1: Use the 'Auto' setting. This seems to work most of the time. In my case it gives 178 - 255 as values. Option 2: Adjust manually, this can also be used to make it more restrictive and then apply filters to the resulting image to enhance the result.

The max threshold will most likely always be 255 (all white). I went for the Auto this time. Here is the resulting image, if you look at it in zoom you'll see some detail was lost, but not too much.

Image after color threshold (click to zoom)

Step Three make background transparent: This is very straightforward when you know where everything is, but a bit daunting at the beginning.

  • Add a transparency layer, by selecting Layer --> Transparency --> Add Alpha Channel.
  • Now choose the Select by Color tool from the palette
The Select By Color tool

Once selected, just click somewhere in the background and it will select all the colors around the click pixel, within a range to accommodate slight differences (e.g. all shades of white). Since this is already a pure white background it's not going to do much, but you would need it for regular images as in those the background will never be completely made of pure white. The range is defined by a Threshold in the Toolbox.

After clicking, the whole background is selected. The selection is indicated by a set of moving lines lines that look like this (you won't see much in the thumbnail, click to see the selection):

White background selected. (click to see the detail)

Now you just press the Delete key or select Edit/Clear and the white background will be removed.

Background cleared, selection still active. (click to zoom)

The above is the image as displayed in Gimp with a transparent background (Gimp uses a checkered gray background to indicate transparency). Now the final image looks like this:

Final, transparent image

Finally all you have to do now is take this image and insert it into a separate layer either in Photoshop/GIMP or Illustrator/Inkscape and add the rest of the elements and shading.

So, why all this trouble? what was the point? Well, color is much easily applied in a layer below the ink layer. If you try to apply color over an unmodified scan, well, it's not going to be easy. In order to do that, you need a transparent ink layer.

But we will leave that for a future post.

Update: You can see the final image in the this comic post.

(Follow me on Twitter, on Facebook or add this RSS feed) (Sígueme en Twitter, on Facebook o añade mi feed RSS)