|
Inkscape: Vector Graphics For Linux
Raster vs. VectorJust about everybody has heard of The Gimp. It's a raster based graphics editor that's available for Linux and Windows. Other raster editors include Microsoft Paint, Adobe Photoshop and Ulead PhotoImpact. A graphic produced by The Gimp is just a bunch of pixels on the screen. As a matter of fact, if you take a swipe across your screen with the eraser tool, you'll be erasing a swath of pixels, whether it's a shape, line, color or whatever. There are no properties, links or intelligence built into any particular graphical element. It's also known as a bitmap. Inkscape is different. It's vector based. Here's how it works. Suppose you insert a filled square onto the screen of a vector graphics editor and then decide you want to change the fill color. That's easy. Just highlight the square and then call up the fill properties panel. Choose a new color from the color wheel and poof, new color on the square. You adjust the properties of the graphical elements, instead of just shuffling around the individual pixels and their colors. Virtually every 2- and 3-D CAD system are vector based. Inkscape is also an open source vector graphics editor that uses the SVG (scalable vector graphics) file format. This is neat because SVG is an evolving standard based on XML that can be massaged via programs, scripts or a simple text editor. In this story we'll do a quick primer on how you can get up to speed on Inkscape. Along the way, we'll explore situations where a vector based graphic would be better suited for a job than a raster based picture. In spite of not being an XML or web development expert I think SVG will be important in the future. Read on and you'll see why.
Drawing With VectorsIf you can use The Gimp, you can use Inkscape. Just remember that you are now dealing with objects...not pixels. Pushing vector objects around has it's advantages over raster. Here are several examples:
If Inkscape needs to be installed, Windows users can find a downloadable version at http://www.inkscape.org/win32-snap/. Likewise, Linux users can download binaries from Soureforge at http://sourceforge.net/project/showfiles.php?group_id=93438. Debian (and Debian based distribution) users can simply use their package management system to find and install the application. Once I had it installed I could call it up from my KDE main menu (See Figure 1). I could also run it from the command line with: $ inkscape After the program started up, a new document appeared in the window ready for action. My object shape and text choices were on the left side. Flipping and rotating entities were handled by the icons just above the horizonal scale line. I clicked the magnifying glass with the piece of paper in it to expand the document to fill the window. It makes it easier to work with. Adding a basic shape was easy. I could choose filled squares, circles, stars and spirals by clicking on the shape and then clicking where the shape should go in the document window. When I clicked on the drawing, I continued to hold the left mouse button down to change the size dynamically. Release the button when it's the size you want. Lines were created the same way, although there are three different line buttons. It's possible to draw freehand, Bezier curves/straight lines, and calligraphic lines, as well. Unlike raster drawings, you can move or stretch the lines using the handles, once they're positioned on the screen. To make handles appear on an object, click on an object followed by the handles button (right below the arrow button, left side). Text worked as you would guess, although the default 12 point font, on the standard 8.5 x 11.0 inch document sheet needed to be enlarged. I reset the default font size to 40 points under the Text, Text and Font tabs. That gave a nicely proportioned font without need of arbitrary resizing. To show how easy it is to get started with Inkscape and vector graphics, I drew my new logo using the package. The process was relatively straightforward.
Vectorize Your LogoThe following steps show my journey through a logo editing session using Inkscape. Setup
Adding The Main Text
Adding Gradients To The Text
Figure 2 shows the main text (blue and red) and the shadow text below. Adding some perspective lines to my logo were as easy as selecting the Draw Bezier curves and straight line button (on the left) and then adding them to the document. Be sure to position the cursor for one end of the line then click, followed by the other end with a single click. Without moving the cursor off of the second endpoint, click again to make a straight line. If you move it one way or the other you'll get a Bezier curve. Perhaps not what we want. After inserting the lines, you'll want to highlight them all again (with the shift key) and then hit the "Lower selection to the bottom (End)" button. That puts the lines behind the text so it looks right. Finally, I wanted to add a "consultant" line below my name. Here's the easy graphical/XML way:
Just so you have an idea of how valuable the SVG/XML format can be, I opened newlogo.svg using vi. I searched for "Rob," which showed up in the main name text and it's shadow and then replaced it with "Mick." Next, I exited vi and called newlogo.svg up in Inkscape again. Low and behold there it was, "Mick Reilly," with all the right colors and proportions. Afterwards, I changed it back to "Rob." Going one step further, I even changed the text using sed, the venerable, old stream text editor. The command line looked like this: $ sed 's/Rob/Jack/' newlogo.svg > newlogo2.svg This time, in Inkscape I opened newlogo2.svg to find Jack's new logo. How is that for slick. I'll bet that gives you some ideas. There you have it. A new logo that took about 10 to 15 minutes to create. Figure 3 shows a view of the finished product within Inkscape.
Some Advanced Vector OperationsTwo other vector operations need to be covered before we briefly look at how you can use Inkscape and SVG files. A very interesting feature you can use is to make text follow a line. Any line.
Try it yourself. You can even do it with a spiral. How about doing some Boolean operations on shapes? For example, you can select two overlapping red filled circles and then use the exclusion menu item under the Path button to combine the circles. The area where the circles overlap is excluded from the result and so is removed from the shape. If you move the combined circle shape on top of a blue filled circle, you'll be able to see the blue circle through the hole. Inkscape has a multitude of Boolean operations that can be used including union, difference, intersection, ect. You can also do other operations like break apart a combined shape or creating insets and offsets of shapes.
Using Inkscape and SVGInkscape and vector graphics are great tools for constructing re-usable graphics. They also save time when it comes to making graphics that need to be tweaked or changed. And, as we've seen modifying the graphics can easily be accomplished manually using a simple text editor or even through programming. That's the real beauty of SVG, the ability to change the characteristics of the graphics by manual or automated ways. It's not all fun and games though, because there are some costs or inconveniences associated with using vector elements. The two big disadvantages, right now, are: Raster graphics can handle the subtle differences in color and contrast that is inherent in a photograph or scanned image. You might say that raster images are real life pictures, like photos. Vector graphics are generated or programmed images. You build them from lines, shapes, colors, etc. Raster can look real, vector usually looks mechanical and precise. So for realistic scenes, portraits, nature and the like you can use a raster image. For web graphics, logos, signs, or other scenes along these lines you'd use vector images. Especially they needs to be changed much. Right now, in order to view those files directly in a browser, it has to be SVG enabled. I downloaded version 1.8b of Mozilla so I could view my handiwork. Microsoft's Internet Explorer supposedly is able to handle SVG graphics through the use of plug-ins. I have not tried it. There is salvation for limited browser support, because Inkscape can export the widely used the Portable Network Graphics (PNG) file format. This is a universally used bit-mapped format for Web images. Inkscape will also export Adobe Illustrator (.ai), regular postscript (.ps) and encapsulated postscript (.eps). PNG can be converted to other bitmaps using The Gimp or XV. It's painless to convert the native SVG files over to PNG using Inkscape on the command line. Here's how I generated a 300 dpi PNG bit-mapped image from Jack's logo example (See Figure 4): $ inkscape -export-png=newlogo2.png -export-dpi=300 newlogo2.svg The original PNG file came out to 2083 X 708 pixels, so I crunched it down to 800 X 600 for display As you can see, Inkscape has some pretty productive features. Let's wrap up our discussion with a little summary.
Graphics In The FutureWe opened our discussion with the differences between raster and vector graphics images. Later, we walked through how to use the features of Inkscape to create basic geometric shapes. We also stepped through a real world example of designing a logo and how you might change it with the Inkscape editor, the built in XML editor, the common Linux text editor vi, and from the command line using sed. Talk about options. I think the best feature, that Inkscape offers over other graphics editors is the ability to work in vectors. All objects in a drawing (document) have characteristics and values that can be easily manipulated. The objects have intelligence. That ability is what makes Inkscape so useful. I'm sure you have lots of ideas that you'd like to try. Go ahead, load Inkscape on your machine and give it a spin or rather, draw. Explore and have fun. In a very short time, I'm sure you'll be replacing The Gimp with Inkscape, for many of your repetitive graphics related chores. I know I will. Rob Reilly is a consultant, writer, and commentator who advises clients on business & technology projects. His Linux, portable computing, and public speaking skills-related articles regularly appear in various high-end Linux and business media outlets. For more tips visit his Web site at http://home.earthlink.net/~robreilly.
|