About TCAW - Subscription Info
June 2002
Vol. 11, No. 6
pp 17–20.
Table of Contents
TCAW Home
Electronic Reader Service
Contact Us
 
 
Computers in Chemistry
Hank Simon
Scalable Vector Graphics

This new file format may make it easier and faster for researchers working with Web images.

Webpages are wonderful things, at least until you get to graphics files. Most of us have probably spent hours or days waiting for even simple graphics to be downloaded so we can see a webpage. The graphics bottleneck is about to be broken with a new graphics file format, scalable vector graphics (SVG). The new format may have a far-reaching impact on the Web and on the display of scientific images.

Two different file formats encoding the water image above.
Two different file formats encoding the water image above.
Current Graphics
Graphics files, up to this point, have been large for the amount of readable information they contain. Complex images, like photographs of people or scenery, are still best represented by traditional image files. While a picture may be worth a thousand words, a picture of the word BACK (as in the BACK button on a webpage), is worth only one. Using an image is a really inefficient way to display the word BACK, because the image file may be large enough to actually contain a thousand words.

In a traditional graphics file, a BACK button image is created by specifying the color and brightness of each pixel of the image, which means that a very large amount of information is associated with just this one word. Well-known graphics formats such as JPEG and GIF compress the image data, but the files remain large. In a text file, BACK is represented by the ASCII code for each character—the computer interprets the code to show the word on the user’s monitor. Although ASCII is an efficient way to display information, it can’t be used to create eye-catching Web images such as a BACK button with a rainbow background and polka-dot letters.

Hypertext markup language (HTML), the language that webpages are written in, allows more formatting than simple ASCII text. Text can be made bold, centered, left-justified, and formatted other ways to make the text more readable. To make these formatting changes, HTML programmers make the files slightly larger by adding hidden text instructions that tell Web browsers how to display the text. Using HTML allows more creative display of the BACK button than ASCII code, but it still can’t be used to create a rainbow background and polka-dot letters.

Enter SVG
Scalable vector graphics are images that computers can display from a set of geometric instructions instead of using information on each and every pixel, as traditional image files do. Put simply, SVGs are built on a collection of lines described as a set of endpoints. They are a mathematical and logical description of the structures that make up the image.

This vector-based, rather than pixel-based, representation of an image produces several advantages, including fast download, small file size, scalability, ease of development and editing, text searching of graphics, and compatibility.

Speed. The main motivator for SVG’s development is speed of download, which is directly related to file size.

Because SVGs are logical descriptions of lines—sets of numbers—they can fly through tight bandwidth connections that typically choke on bulky image files. SVG files are in text format, so they are smaller and more compressible than comparable JPEG or GIF images.

Scalability. Scalability is an important feature of SVG. The ability to change the size of an image or to focus on a portion of an image without degradation or loss of detail is a fundamental element of SVG. Changing the size of an image makes SVG potentially attractive to Web authors tailoring their pages to fit a variety of different Web-surfing devices such as cell phones and personal digital assistants. The same graphic can appear correctly on any display without the need to make new images to fit different dimensions.

Focusing on a portion of an image (zooming in) is an automatic part of SVG implementation. Zooming in on an SVG-enabled map, for example, is fast and can provide additional details such as street names, building addresses, and topographic information. Manipulation of molecular models, such as visualization, rotation, and analysis, can be performed in the client browser, independent of the display device being used. In addition, a researcher might include annotations (such as names or functions) on molecular models, which are unobtrusive during manipulation but visible when users zoom in.

Ease of development and editing. Another goal of SVG technology is to integrate graphics more tightly with documents on the Web. Because it is based on eXtensible Markup Language (XML) (see Today’s Chemist at Work, March 2000, p 17; May 2000, p 15), an SVG image can be included alongside data and text and manipulated by XML authoring tools.

Standards and XML

The SVG specification, first proposed in January 1999, is designed to make (small file size) images that can fit any screen—from cell phone displays to large monitors. But the goal was also to make a file format that can produce graphics and multimedia products and presentations that work on all operating systems and applications.

To do this, more than 20 organizations, including Sun Microsystems, Adobe, Apple, IBM, and Kodak, worked with the World Wide Web Consortium (W3C) to develop SVG based on XML.

SVG is not a standard as such, because the W3C is not a standards body. Instead, the W3C publishes recommendations, which are informal standards and specifications.

Many organizations have an existing XML infrastructure. Because the same XML infrastructure is used for graphics, text, and other data, the same tools can be used for making and manipulating documents. That’s a very powerful ability, because it means that it’s just as easy to have a graphic view of data or information as it is to have a text view. In addition, the files, and hence the images, can be modified by a wide range of tools. In fact, in a pinch, a developer can use a simple text editor, such as MS Notepad, to make minor modifications to the SVG image.

Text searching of graphics. The text is not part of a graphic, so it is searchable. This means that a collection of SVG images can be searched for text strings such as labels, tables, names, titles, and more, just like any other text document. Although SVG can be used to create graphics-based text, the designer can include text strings as part of the SVG image, which allows the user to search for specific information.

Compatibility. Microsoft’s Internet Explorer has had support for its own predecessor to SVG, vector markup language (VML), but it hasn’t really achieved widespread deployment on websites. Now that SVG is the standard, analysts expect Microsoft to drop VML and embrace SVG. In fact, Internet Explorer can process both VML and SVG by using the appropriate plug-ins available at the Adobe website (www.adobe.com/svg/viewer/install/beta.html). Another nice feature of SVG is that the plug-in also works with Netscape, enabling the two most popular browsers to render SVG images.

Animation. SVG is compatible with Java, JavaScript, and most other scripting tools. SVG images can be animated and made interactive, but cost less to produce than Macromedia Flash images. In addition, the data for an SVG-based molecular model can be shared across applications, displayed on different devices, incorporated in reports, or sent to a printer with no structural modifications.

The World Wide Web Consortium, in addition to developing the SVG file format, put forth a recommendation (not officially a standard) for synchronized multimedia integration language (SMIL, pronounced “smile”). SMIL is an addition to SVG that allows animation of vector graphics. SMIL enables Web developers to sync sound, text, and other multimedia elements by using simple tags rather than complex Java programs.

Additional Resources for SVG

Sites with SVG graphics

Chemicals, www.ch.ic.ac.uk/svg
Bonds, http://eclectic.ss.uci.edu/~drwhite/0/protein_klev.htm

Animation

www.w3.org/TR/SVG/images/ animate/anim01.svg
www.sun.com/software/xml/ developers/svg/shadow-effects

What Can SVG Do?
SVG enables Web developers to create dynamically generated, high-quality graphics from real-time data with precise structural and visual control. With this powerful new technology, SVG developers can create a new generation of Web applications based on data-driven, interactive, and personalized graphics. This means that the numeric output from a mass spectrometer (or any instrument) can be modified with relatively simple transformations to generate SVG image data.

SVG can generate any two-dimensional image, so it is great for molecular representations. It can also handle motion, transformations, shading, and shadows, providing a foundation for three-dimensional imaging. A molecule represented in SVG can be made to rotate with minimal programming and can be scaled, labeled, and searched.

The SVG graphic produced from an instrument or by a designer can be more valuable than a conventional image of the same subject. A protein model made using SVG might work equally well with software from the genetics, synthesis, or polymer fields of study. For example, a chemical company might design an interesting molecule using a standard molecular modeling package. The chemistry SVG information could be exported directly into a synthesis package to design the steps needed to build the molecule. Currently, such a model might have to be translated, imported, or even redrawn to transfer the data from one application to another. SVG simplifies sharing two-dimensional graphics data.

In the end, SVG can bring graphics, especially scientific graphics, into the 21st century, allowing them to be searched, animated, and interacted with in a platform-independent manner.


Hank Simon has worked with artificial intelligence and knowledge discovery systems for 22 years. Send your comments or questions regarding this article to tcaw@acs.org or the Editorial Office, 1155 16th St N.W., Washington, DC 20036.


Return to Top
|| Table of Contents

 CASChemPortChemCenterPubs Page