Optimizing SVGs

The other night I came across this cool Tree of Life page, featuring some pdfs and images of the family relationship of all life on Earth. Great stuff. Among them, this simplified rendition divided into about a hundred sub-families, and their relations:

You see our really ancient common heritage starting at 0 radians, progressing through evolution towards the really highly evolved creatures at two pi radians; birds, crocodiles, turtles and (you are here!) mammals (but in reverse order; sorry -- us mammals are not the last cry in evolution in all ways conceivable :-).

I liked it, but it felt wrong that it was trapped in a pdf; this kind of thing should really be a Scalable Vector Graphics image (SVG, henceforth) with cut-and-pastable text, and both readable and hackable right in the page source, for people like you and me that like to poke around in things.

So I made an exercise turning it into a somewhat nice SVG, to see both how small I could make it, without much effort, and where browsers are at in terms of rendering an inline SVG, these days. I haven't actually tested yet, so it'll be a fun surprise for me too, upon publishing this post. And if your browser doesn't render it, you still had the rasterized version above, or the source pdf (35008 bytes long).

Oh, and for the curious, there's a public git repository of all the changes on github, one step at a time, from the first version (where it's helpful to have a friend that has Adobe Illustrator, for instance, to do an initial machine translation of the pdf to a workable yet messy SVG). For reference, this page does not embed the minimized end result, which weighed in at 14852 bytes (or 6038, gzipped to an svgz).

(I consider those cheating, as the line data itself has been compressed somewhat beyond the point where it's still hackable.)

If you want to play around with this kind of thing, and get familiar with hand-editing SVG files, I can whole-heartedly recommend Sam Ruby's great library of sub-kilobyte hand-made SVG:s. While I can't find a statement to attest to it at the moment, I believe they are all freely MIT licensed (I think I asked him in person at SVG Open 2009), encouraging you to learn from and play with them. It is a great resource if you want to start playing with this yourself and want to pick up on some of the tricks of the trade, since they, on average, contain pretty much 100% signal, 0% noise.

Oh, and the SVG specification when you are curious about something specific. If you want to learn a minimal subset only that can do almost everything, look at the <path d="turtle graphics here"/> attribute.

And here is the outcome of my own craftsmanship, for the browsers that get it:

Spirochaetes Chlamydias Hyperthermophilic bacteria Cyanobacteria Low-GC Gram-positives High-GC Gram-positives Deinococcus/Thermus Proteobacteria Crenarchaeota Euryarchaeota Haptophytes Brown algae Diatoms Oomycetes Dinoflagellates Apicomplexans Ciliates Eudicots Monocots Magnoliids Star anise Water lilies Amborella Conifers Gnetophytes Ginkgo Cycads Ferns Horsetails Whisk ferns Club mosses and relatives Hornworts Mosses Liverworts Charales Coleochaetales Chlorophytes Red Algae Glaucophytes Kinetoplastids Euglenids Heteroloboseans Parabasalids Diplomonads Foraminiferans Cercozoans Radiolarians Amoebozoans Club Fungi Sac Fungi Arbuscular Mycorrhizal Fungi "Zygospore Fungi" "Chytrids" Microsporidia Choanoflagellates Glass sponges Demosponges Calcareous sponges Placozoans Ctenophores Cnidarians Bryozoans Flatworms Rotifers Ribbon worms Brachiopods Phoronids Annelids Mollusks Arrow worms Priapulids Kinorhynchs Loriciferans Horsehair worms Nematodes Tardigrades Onychophorans Chelicerates Myriapods Crustaceans Hexapods Echinoderms Hemichordates Cephalochordates Urochordates Hagfishes Lampreys Chondrichthyans Ray-finned fishes Lobe-finned fishes Lungfishes Amphibians Mammals Turtles Lepidosaurs Crocodilians Birds

Unfortunately Blogger intersperses it with <br> tags if I leave the new-lines in, so see github for a cleaner version. No luck with my current set of browsers, with at least this doctype and HTML version. It does degrade to showing the text content of all the families, though, which a PDF wouldn't.
blog comments powered by Disqus