Vector Graphics and Animation Formats

about | archive


[ 2006-February-21 21:38 ]

Most computer graphics are stored and distributed in a raster format, such as the standard JPEG and PNG formats. These formats are great for photographs or scans, but bad for computer generated art. This is very noticeable if you zoom in on a PNG image of a graph, or text. The result is big blocky pixels, instead of a smooth line. Vector graphics are an alternate approach where you describe how to draw the desired image, rather than specifying what the resulting pixel values are. Generally this takes up less space, since a single draw command will set the value for many pixels. Perhaps the largest benefit is that it can be rescaled, since the computer can redraw the image at any size. Unfortunately, vector graphics are also much more complex than raster graphics, since essentially they are a very specialized program. Today, there is an unfortunate lack of consensus on standard vector graphics formats. This is extremely annoying, and I hope that the industry sorts it out soon. This post describes the sorry state of the modern vector graphics landscape.

Postscript

In the dark ages of vector graphics, Postscript was created by Adobe. It is now the defacto standard for print output. Unfortunately, Postscript is a pretty complex standard, and it doesn't help that it is a complete programming language (for example, there is a web server written in Postscript). Adobe realized that it was too complex, and annoyingly depended on external fonts, so they created PDF. PDF has been very successful and is widely used for distributing electronic documents. It can also be used for graphics of any size, which can then be embedded in other documents. Unfortunately, despite PDF being a relatively open standard, very few applications support it. An exception is that nearly all applications on Mac OS X have excellent support for PDF, since it has been part of the operating system for a long time.

Flash

Back in the dark ages of the web, only raster graphics were supported. FutureWave/Macromeda stepped up and created a plug-in for vector graphics and animation that has been wildly successful. Flash now includes multimedia playback and recording capabilities, a programming language based on JavaScript, and the ability to communicate over the network. However, if we ignore those extra features and focus on Flash as a vector graphics format, there is a lot to like. There is a widely deployed player, a robust and popular editor, and a fair number bit of third party tools for creating Flash files. Unfortunately, there is one huge problem: Flash is not an open standard. Adobe's licensing agreement for the Flash file format specification clearly states that third parties may not import Flash, they can only export it. There are a variety of open source tools that input and output Flash, but until I am informed otherwise by either by Adobe or a lawyer, this is a legal grey area. For example, imagine what would happen if Microsoft decided to make a tool that imported Flash files. Would they owe Adobe a licencing fee? Would Adobe sue? The answer is unclear, and this means that Flash is useless in my mind.

Scalable Vector Graphics

The newest format for vector graphics is Scalable Vector Graphics (SVG), an XML-based standard from the W3C. Some web browsers are finally beginning to support SVG, so it may start to gain popularity. Unfortunately, it is a massive standard (719 pages), which means that implementing it is very complicated. For example, Mozilla Firefox supports SVG starting with its 1.5 release, but it only supports a subset. The development team has a detailed description of the SVG features not supported by Firefox 1.5, and a discussion about why they don't implement everything. In my opinion, using XML does not make sense for graphics. It makes sense for data that needs to be consumed by programs, where XML's flexibility and standard parsers make life easier for developers. However, in the case of SVG, I think that this makes things more difficult. For example, SVG does not actually use XML to describe curves, instead it defines its own text-based language. Even worse, SVG can be combined with Cascading Style Sheets, another horrendously complicated standard.

I do not think that SVG is without merit. For example, Inkscape uses it as its internal format. This makes sense, as it uses XML's ability to add extra attributes and elements to describe higher-level Inkscape objects, while still retaining compatability, such as it is, with other SVG applications. However, I still think that it is far more complex than necessary.

Hope

Despite these issues, not all is lost in the vector graphics world. The biggest cause for hope is that the major platforms (Java, Linux, Mac OS X, and Windows), all now support high-quality vector graphics based on the Postscript model. Java has Java2D, Mac OS X has Quartz, Linux has Cairo, and finally, Windows has Windows Presentation Foundation (WPF, aka Avalon). Since all platforms now have graphics APIs that are more or less equivalent, what we need is a very simple file format to enable programs to exchange high-quality vector graphics. I hate to propose yet another vector graphics format, but I think that is exactly what I am doing. If someone were to create a very simple and open format for vector graphics, I think it might be useful. I certainly would be using it. An alternative approach would be for the core platforms to support for one of the two existing open standards: PDF or SVG. Mac OS X already provides excellent PDF import and export capabilities, so if the other platforms could provide similar functionality, that would solve part of my problem. However, I am always a fan of simple technology. I expect that the industry will eventually gravitate towards a single standard. I just hope it happens sooner rather than later.