Subscribe by email
Want updates? Enter your email


Delivered by Google FeedBurner
No spam, total privacy, opt out any time
News
« Lower case j | Main | How to choose an image format »
Wednesday
Aug082012

When to use vectors not rasters

In yesterday's post, I looked at advantages and disadvantages of various image formats. Some chat ensued in the comments and on Twitter about making drawings and figures and such. I realized I hadn't been very clear: when I say 'image', I really mean 'raster' or 'bitmap'. That is, a discretized (pixel-based) grid of data.

What are vector graphics?

Click to enlarge — see a simulation of the difference between vector and raster art.What I was not writing about was drawings and graphics combining text, lines, and images. Such files usually contain vector graphics. Vector graphics do not contain descriptions of pixels, but instead they contain descriptions and positions of text, paths, and polygons. Example file formats are:

  • SVGScalable Vector Graphics, an open format and web standard
  • AI — a proprietary format used by Adobe Illustrator
  • CDRCorelDRAW's proprietary format
  • PPT — pictures in Microsoft PowerPoint are vector format
  • SHP — shapefiles are a (mostly) generic vector format for GIS

One of the most important properties of vector graphics is that you can rescale it without worrying about changing the resolution — as in the example (right).

What are composite formats?

Vector and raster graphics can be combined in all sorts of ways, and vector files can contain raster images. They can therefore be used for very large displays like posters. But vector files are subject to interpretation by different software, may be proprietary, and have complex features like guides and layers that you may not want to expose to someone else. So when you publish or share your work it's often a good idea to export to either a high-res PNG, or a composite page description format:

  • PDFPortable Document Format, the closest thing to an open, ubiquitous format; stable and predictable.
  • EPSEncapsulated PostScript; the precursor to PDF, it's rarely called for today, unless PDF is giving you problems.
  • PSPostScript is a programming and page description language underlying EPS and PDF; avoid it.
  • CGMComputer Graphics Metafiles are best left alone. If you are stuck with them, complain loudly.

What software do I need?

Any time you want to add text, or annotation, or anything else to a raster, or you wish to create a drawing from scratch, vector formats are the way to go. There are several tools for creating such graphics:

Judging by figures I see submitted to journals, some people use Microsoft PowerPoint for creating vector graphics. For a simple figure, this may be fine, but for anything complex — curved or wavy lines, complicated filled objects, image effects, pattern fills — it is hard work. And the drawing tools listed above have some great advantages over PowerPoint — layers, tracing, guides, proper typography, and a hundred other things.

Plus, and perhaps I'm just being a snob here, figures created in PowerPoint make it look like you just don't care. Do yourself a favour: take half a day to teach yourself to use Inkscape, and make beautiful figures for the rest of your career.

PrintView Printer Friendly Version

EmailEmail Article to Friend

Reader Comments (5)

Jeez, I just finished reading the last one! Another helpful article, thanks. Added to my bag of links.

I already spent a long time commenting on the previous article so I'll be brief here, except to re-iterate that when I work I tend to leave everything in a vector-style format for as long as possible as they are easier to edit and revise, but when I deliver the final product it's typically in a rasterized format, or at least a "composite" format like a PDF, just like what you mention above.

I try to always consider how the file will be used, and pick the right format for that. There is no one "right" format, just like there is no one "right" screwdriver. You can have a favourite (Robertson - Canadian-made, self-aligning, colour coordinated - it is the awesome-est), but sometimes you need a different tool for the job.

Lastly, it's worth pointing out that vector files, especially purely vector files, can often be significantly smaller than their rasterized cousins. Try converting a word document to a PDF directly, and then scan a printout of that same word document. The PDF created directly will be probably 10% of the size, for 8.5x11 paper.

The difference can be even more significant as the paper size gets bigger - for a colour A1-size (36x24) landscape plan I have the PDF is about 0.7MB, whereas the jpeg version is 13.8 MB, and the tif is 233 MB.

August 8, 2012 | Unregistered CommenterReid

@Reid: It's funny how tempting it is to say something is the best, but you're right, it's usually a waste of time. All this stuff exists precisely because there is no 'best'. Even CGM seems to have a place, though I'm not sure where it is (the Computer History Museum?). We all know how 'best browser' arguments go.

The size thing is interesting. It's a kind of sparseness, I guess. But a semantic sparseness — drawings are sparse in the vector domain. What kind of image would be sparser in the raster domain? Something like white noise, perhaps. Or a fractal.

August 8, 2012 | Registered CommenterMatt Hall

Thank you, for extending this discussion. Inkscape could you possibly go a bit more into depth on this software. I am always looking for a open source alternative to Adobe products.

August 9, 2012 | Unregistered CommenterMichael Wallace

@Michael, Matt and I use Inkscape nearly every day. Every figure that gets published on the blog. So you can comb back through the posts to see what it (or what we) can do. I may not be a power user, but it hasn't failed me yet. All of our cheatsheets were done in Inkscape too, which have a fair bit of intricacy. Agile cheatsheets

August 9, 2012 | Unregistered Commenterevan

@Michael: Best thing is to give it a spin, maybe try a tutorial. I don't use Adobe Illustrator much, as I find Inkscape quite adequate. Typography is a little better developed in AI (not surprisingly, given Adobe's depth there). When saving SVGs, certain features don't display well in all browsers — that may be a problem with browsers and SVGs rather than Inkscape, and I doubt AI does much better. Of course, AI has a seamless relationship with Photoshop and other Adobe tools, which some people probably couldn't live without. Inkscape exports nicely to PNG and PDF, and that's fine for me. It's very stable these days — I don't remember the last time I had a crash or freeze (running recent versions on MacOS 10.6). Good luck!

August 9, 2012 | Registered CommenterMatt Hall

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Post:
 
Some HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>