Contents ~ Posts ~ Gallery ~ Free Images ~ GIMP 2.8 Shortcuts ~ Stickers! ~ Travel Accessories! ~ Wall Art!

24 July 2012

A Newbie Adventure into Scalable Vector Graphics

A Short Tutorial

Back in February 2011 I decided I wanted to learn how to create scalable vector graphics using Inkscape. For my first project I chose something very simple — a paper bag. I found an image of a paper bag to use as a model and loaded it into Inkscape. After a quick analysis it was pretty obvious where to draw the lines.

Using the Draw Bezier curves and straight lines tool  Inkscape Bezier Pen Tool, I traced various sections of the bag until I had the following:

Paper Bag Outlines

Here's an exploded view to show each vector object:

Paper Bag Outlines Exploded View

The next step was to set the color and do the shading. This can all be done in the Fill and Stroke panel, which is accessed by the triangle/brush icon (1). For each vector object, I first used the Pick colors from image tool (2) to pick a color from the corresponding part of the original bag image. Then I selected the Linear gradient button (3), which creates a line across the object. The square endpoint is set automatically to 100% opacity, and the round endpoint is set to 0% opacity.

Fill and Stroke Controls

I moved the endpoints of the gradient for each object so that the flow of light to dark went in the correct direction.

Paper Bag All Gradients

After exporting the image as a bitmap and playing around with it a bit, I discovered that using opacity to control lightness and darkness was not really a good idea.

Background Shows Through

Any background that the bag is placed on shows through in the low-opacity areas. I also noticed bleed-through at the junction points between various parts of the bag. My solution to the opacity problem was to create another copy of all the bag objects, except in white, and place them under the bag.

White Bag

This stopped the show-through problem, though you can still see thin white lines along the edges where objects meet.

Paper Bag Version 1

Well, this obviously wasn't an optimal solution, so I proceeded to work on version 2. First, I made a copy of my paper bag file so I wouldn't lose my original version. Next, I set all the gradient endpoints to 100% opacity, adjusted the gradient line lengths, and selected an appropriate color for each endpoint based on the corresponding part of the original paper bag image.

Paper Bag Version 2 Gradients

To fix the thin line show-through problem, I drew around the entire bag to create a new vector object that I colored a medium tan.

Brown Bag Silhouette

I put this object behind all the other bag objects. I now had a paper bag that would look OK on any background. I'm pretty pleased with the result.

SVG Paper Bag Version 2

Related Articles

The Further Adventures of a Vector Graphics Newbie
How to Create a Vector Clown Fish with Inkscape

No comments:

Post a Comment