gotcha

 


Convert Raster ("Bitmap") Images to Vector - master tutorial

Submitted By: brynn Date: January 10, 2016, 06:53:04 AM Views: 6950
Summary: If you're not sure which tutorial you need, read this one first.

How to Convert Raster ("Bitmap") Images to Vector

There are 3 ways to convert a raster image to vector:

1.  trace it more or less automatically, using a trace engine, such as Inkscape's Trace Bitmap (Path menu) 1
2.  trace "by hand" using other Inkscape path tools (such as Pen/Bezier or Pencil/Freehand tools), including using a graphics pen and tablet with Inkscape's Calligraphy tool
3.  "build" the design using Inkscape shape tools, and/or path tools

There are advantages and disadvantages to each (which are discussed further below), and your choice of which one to use depends on 3 or 4 things:

1.  your intended use or goal for the converted image
2.  the quality and complexity of the original raster image
3.  any past experience with Inkscape you may have

The tutorials you will find below show how to use the Pen/Bezier tool and Trace Bitmap feature, for all the various situations you might encounter, when converting a raster image to vector (or as many as I can think of, anyway).  Here are a few more resources. 
  • A long, detailed tutorial I wrote a while ago, as an introduction to drawing vector paths:  How to Draw a "Line" with Inkscape  However, it does not cover editing paths -- only drawing them.
  • Help menu > Inkscape manual (needs an internet connection, unless you purchase the manual) or direct link
  • Inkscape Floss Manual
  • Help menu > Tutorials > Advanced  --  It's not really advanced, but instead, most of it is an introduction to vector paths (except for the first section on pasting techniques and the last section on text).
In some cases, it might be possible to use the Pencil/Freehand tool.  But most of the time, the Pen/Bezier tool is best -- even it if takes a little longer to learn.  In the end, it will pay off to learn how to use it, even if you just have one project to complete.


Difference Between Auto-Trace and Hand-Trace

Often the decision about which technique to use is easy, once you understand how auto-tracing works.

Using the front leg of the mountain lion sketch (small pink rectangle) as an example, you can see the difference between using an auto-trace (on the left of the bold, blue line below) and a hand trace (on the right below).

   

The 3 images on the left of the bold blue line demonstrate what happens when you use Inkscape's Trace Bitmap (or other trace engine).  Basically there are 8 scans creating 8 different colored compound paths (actually 8 shades of gray here) all stacked up on top of each other.  (Only 7 can be seen in that section; and 1 is the white background, in case you're counting.)  I placed a red outline around the color which is selected, to help you see it better.  So you can see that the image is made up of very detailed closed paths, rather than a series of single lines or strokes.  (The settings I used to create that auto-trace can be found in this tutorial.)

The images on the right of the bold blue line, show how the paths look when traced by hand, with the Pen/Bezier or Pencil/Freehand tool.  I colored them red, to make it easier to see.  You can see that they are more like typical strokes, that a sketch artist might make with pen, pencil or charcoal, etc.

How to Use This Tutorial

Actually this is sort of a master tutorial, explaining some basic concepts, and guiding you to the particular tutorial you might need.  The best way to use it, from this point on, is to quickly skim through until you find a sample image that is similar to the kind of image you need to convert.  When you find something similar, that's the section you need to read.  To make it even easier to find a tutorial, the sample images are numbered, and you'll find the image numbers in the heading for each sub-category.  (Sometimes an image number will appear in more than one category.)  And in each sub-category is a link or links to specific tutorials.  If you can't find a tutorial for the type of project you want to do, for the type of image you have, chances are it either can't be done, or would be extremely difficult to do.

But if you have questions, or want to discuss your particular project, please feel free to post in the forum.


Photographs such as family photos, landscapes, or portraits

It's very hard to convert this type of raster image...the whole image...and still retain it's quality.  It can be done (i.e. photorealism), but usually this best use for this type of photo is to convert only part of the image, or create a stylized version of the image.


Create Custom Cutting Files (including for "Print and Cut")  (Images #1 or #3)

There really is only one way to do this, which is "manually" tracing the lines with Inkscape's Pen/Bezier tool.  The Pencil tool could be used, but it tends to create an excessive number of nodes, which which could make Inkscape work more slowly.  Also there are some digital cutters which balk at excessive nodes. 

Create Files for Screenprinting (Such as on T-shirts) or Tranferring Designs to Fabric  (Images #2 or #4)

There are a couple of ways to do this.  You could use the technique explained  in the tutorial above.  But there's a more automated way to do it with Inkscape, (using the Trace Bitmap feature) which I think produces a nice result.  That's explained in the following tutorial.

Drawing a PhotoRealistic or PseudoRealistic Portrait or Image  (No sample image provided, since any image which you might have the courage to try, can theoretically be drawn in a PhotoRealistic style.)

PhotoRealism is extremely time consuming and detailed work, using Inkscape.  Typically one encounters performance issues, due to the large files sizes which result from either a large number of nodes, a large number of gradients, or heavy use of filters (usually blurring), and probably all of those.  It can only be done by tracing the photo with Inkscape Pen/Bezier tool.

Non-Vector Uses

There are many ways to use photos like this in an artistic way, with Inkscape.  They aren't necessarily converted to vector images, but here are a few of those anyway:




Line Drawings

There are a few different drawing styles, which could be described as "line drawings".  Some examples are below.  Click on the collection of images, to see the full size.


Sketch to Vector

One kind of line drawing is a sketch, and there are many ways sketches can be made.  In this case, we're talking about something drawn by hand, usually on paper, that is scanned into your hard drive.  And there are many reasons people might need their sketch to be vectorized.

Pen and Ink, Pastel/Chalk, Charcoal or Pencil Sketch  (Images #8, #11, or #16)

For a pen and ink, pastel/chalk, charcoal or pencil sketch, or any kind of sketch that uses hatching or smudging for shading, there are 2 ways they can be converted to vector.
  • Use an automated trace engine, such as Inkscape's Trace Bitmap (Path menu)

    • Advantages:  can be done fairly quickly, and creates a fairly accurate representation (assuming the results will not be zoomed)
    • Disadvantages:  cannot be edited later (at least not with the same sketching technique), and potentially could tax the system with a large number of nodes (also, such a trace might take a minute or 2, depending on the size of the sketch)

    Importantly using Trace Bitmap alters the basic composition of the sketch, so that it is not a series of single vector strokes (similar to pencil, pen or charcoal sketch strokes), as explained above in the Difference Between Auto-Trace and Hand-Trace section.  This may either be an advantage or disadvantage, depending on your goal.


  • Sketch directly into Inkscape, using a graphics tablet, and Inkscape's Calligraphy tool.  A graphics tablet is a separate hardware, which includes a pen, which acts like the mouse.  They can work with a lot of graphics programs.  Graphics tablets usually have pressure-sensitivity features, so they can make the individual strokes look more like they are drawn on paper.

    • Advantages:  graphics pen strokes create single lines (just like inkpen, pencil or charcoal strokes),and which can be edited later
    • Disadvantages:  must purchase the hardware, and configure Inkscape to recognize it; could also result in a large number of nodes, leading to performance issues


Single Line Sketch  (Images #5, #6, #7, and maybe #10, #11.5, #13, and #15)

There are 2 ways to convert this type of image with Inkscape.  And your ultimate goal for the image determines which way you use.
  • If the line sketch will be used to create a cutting path, for any type of digital cutting technology (such as home/craft cutters, CNC, laser, vinyl, or other), the only way to do it, is to trace by hand, using Inkscape's Pen/Bezier tool.  (Possibly the Pencil/Freehand tool could be used.  But for best results, the Pen/Bezier tool is suggested.)  For this type of cutting, I mean where you plan to cut completely, all the way through the material, with whatever type of machine you have.


  • If the single line sketch will be used to etch the line itself into the material, Inkscape's Trace Bitmap (or other auto-trace engine) is a good solution.  By "etch", I mean where whatever type of cutting machine you're using, doesn't cut all the way through the material, and just removes some portion off the top surface of the material.


Single Line Raster Image to Vector

This is basically the same thing as a single line sketch, except that it hasn't been sketched by hand.  The one thing they all have in common is a black line, either by itself, or as a border enclosing single colored shapes (typically a black line/border, but could be any color).

Maps and Cartoons/Comics  (Images #9 and #12)
Although these are very different types of images, they can be treated together, because because their composition is nearly identical, i.e. shapes consisting of a single color, enclosed by a black line or border.  There are 2 ways to do this for maps, and 3 ways for cartoons/comics.

Any Primarily Geometric Image - (Architectural Drawings, Floor Plans, Technical Drawings, Flow Charts or Other Charts or Graphs, Miscellaneous Geometric Images  (Images #9, #10, #11.5, #12, #13, #14, and #15)
Inkscape has several tools and features which allow you to draw precise or near precise geometric shapes.  So they can be used to re-create any image which consists primarily of geometric shapes.  Or the image may also have non-geometric parts to it, which might require tracing with path tools (Pen/Bezier tool, Pencil/Freehand tool, etc.) as covered by any of the tutorials above.


Other or Miscellaneous Raster Images

If your raster image doesn't seem to fit in any of these categories, please feel free to post it in the forum.  Likely if an image doesn't fit any of the above categories, either it can't be converted to vector, or it would be extremely hard to convert.  But we certainly can't say it's impossible, without having seen the image and heard about your plans for it   :)



1 There are other trace engines around one of which is free and online:  http://www.roitsystems.com/cgi-bin/autotrace/tracer.pl, which can be found by searching the internet.


Rating: This article has not been rated yet.

Comments