<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Apolitically Incorrect &#187; Illustration</title>
	<atom:link href="http://www.oak-tree.us/blog/index.php/category/art/art-illustration/feed" rel="self" type="application/rss+xml" />
	<link>http://www.oak-tree.us/blog</link>
	<description>The Rants and Raves of an Unsettled Mind</description>
	<lastBuildDate>Thu, 27 May 2010 13:36:09 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Hannibal, Napoleon, and Joseph Charles Minard</title>
		<link>http://www.oak-tree.us/blog/index.php/2010/02/22/minard-maps</link>
		<comments>http://www.oak-tree.us/blog/index.php/2010/02/22/minard-maps#comments</comments>
		<pubDate>Mon, 22 Feb 2010 21:49:11 +0000</pubDate>
		<dc:creator>Rob Oakes</dc:creator>
				<category><![CDATA[Computer]]></category>
		<category><![CDATA[Cool Stuff]]></category>
		<category><![CDATA[Illustration]]></category>
		<category><![CDATA[Science and Medicine]]></category>
		<category><![CDATA[Writing and Literature]]></category>
		<category><![CDATA[rapidBOOKS]]></category>
		<category><![CDATA[Charles Joseph Minard]]></category>
		<category><![CDATA[Charts and Graphs]]></category>
		<category><![CDATA[Inkscape]]></category>
		<category><![CDATA[Maps]]></category>
		<category><![CDATA[OpenSource]]></category>
		<category><![CDATA[OpenSource Writing]]></category>
		<category><![CDATA[Statistics]]></category>

		<guid isPermaLink="false">http://www.oak-tree.us/blog/?p=1396</guid>
		<description><![CDATA[	
	<span class="Z3988" title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Adc&amp;rfr_id=info%3Asid%2Focoins.info%3Agenerator&amp;rft.title=Hannibal%2C+Napoleon%2C+and+Joseph+Charles+Minard&amp;rft.aulast=Oakes&amp;rft.aufirst=Rob&amp;rft.subject=Computer&amp;rft.subject=Cool+Stuff&amp;rft.subject=Illustration&amp;rft.subject=Science+and+Medicine&amp;rft.subject=Writing+and+Literature&amp;rft.subject=rapidBOOKS&amp;rft.source=Apolitically+Incorrect&amp;rft.date=2010-02-22&amp;rft.type=blogPost&amp;rft.format=text&amp;rft.identifier=http://www.oak-tree.us/blog/index.php/2010/02/22/minard-maps&amp;rft.language=English"></span>
No study of the history of scientific communication can be complete without mention of Joseph Charles Minard, a 19th Century French civil engineer and cartographer. At the end of his life, Minard created two very famous examples of statistical charts, called flow maps, that every scientist, engineer and student should be familair with.  The first [...]<p>Copywrite 2009: Rob Oakes.  <a href="http://www.oak-tree.us/blog">Apolitically Incorrect</a><br/><br/><a href="http://www.oak-tree.us/blog/index.php/2010/02/22/minard-maps">Hannibal, Napoleon, and Joseph Charles Minard</a></p>
]]></description>
			<content:encoded><![CDATA[	
	<span class="Z3988" title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Adc&amp;rfr_id=info%3Asid%2Focoins.info%3Agenerator&amp;rft.title=Hannibal%2C+Napoleon%2C+and+Joseph+Charles+Minard&amp;rft.aulast=Oakes&amp;rft.aufirst=Rob&amp;rft.subject=Computer&amp;rft.subject=Cool+Stuff&amp;rft.subject=Illustration&amp;rft.subject=Science+and+Medicine&amp;rft.subject=Writing+and+Literature&amp;rft.subject=rapidBOOKS&amp;rft.source=Apolitically+Incorrect&amp;rft.date=2010-02-22&amp;rft.type=blogPost&amp;rft.format=text&amp;rft.identifier=http://www.oak-tree.us/blog/index.php/2010/02/22/minard-maps&amp;rft.language=English"></span>
<p><img style="margin: 0px 15px 0px 0px; display: inline; border-width: 0px;" title="Charles Minard - Railroad Routes" src="http://www.oak-tree.us/blog/wp-content/uploads/2010/02/CharlesMinardRailroadRoutes.jpg" border="0" alt="Charles Minard - Railroad Routes" width="200" height="347" align="left" /></p>
<p>No study of the history of scientific communication can be complete without mention of Joseph Charles Minard, a 19th Century French civil engineer and cartographer.</p>
<p>At the end of his life, Minard created two very famous examples of statistical charts, called flow maps, that every scientist, engineer and student should be familair with.  The first showed Hannibal’s crossing of the Alps (218 BC, Second Punic War), and the second describes Napoleon’s disastrous invasion of Russia (1812-1813).</p>
<p>Both examples are beautiful works of art and masterful examples of evidence.  But they are also more than that, they tell cohesive and interesting stories.  In this post, I thought it might be interesting to take a closer look at the history of Hannibal and Napoleon, and highlight the ways which Minard’s charts help us to explain their eventual outcome.</p>
<p><em>(Note: High resolution, PDF versions of the two maps are available for download.  These versions have been translated from the original French.  To download, either click on the images, or <a href="http://www.oak-tree.us/stuff/OpenSource-Writing/Minard-Hannibal.pdf">here</a> for the Hannibal invasion of Northern Italy, and <a href="http://www.oak-tree.us/stuff/OpenSource-Writing/Minard-Napoleon.pdf">here</a> for the French Invasion of Russia.)</em><span id="more-1396"></span></p>
<h2>Hannibal Invasion of Italy (218 BC, Second Punic War)</h2>
<p><!--adsensestart--><a href="http://en.wikipedia.org/wiki/Hannibal">Hannibal</a> was perhaps the single greatest threat to Roman power to ever live.  At the same time that Roman legions marched unopposed through most of the Mediterranean world, Hannibal lead a force of twenty-five thousand soldiers into the heart of Roman territory. He then spent the next fifteen years occupying portions of the Italian peninsula and generally wreaking havoc.  But even though he ravaged the Roman countryside, Hannibal was never successful in subduing Rome.  Ironically, this might be due to one of his greatest exploits: the overland crossing of the Alps.</p>
<p>Hannibal departed his home base in Spain with nearly 90,000 troops (one of the largest armies that had ever been fielded at that point in history) and had a number of early successes.  He marched north over the Pyrenee mountains and into Gaul (modern day France).  He subdued the Celtic tribes and crossed the Rhone River before the Romans could take measures to stop his advanced.  He forged important alliances and found unexpected friends in his fight against the Romans.</p>
<p>After crossing the Rhone, however, Hannibal’s luck began to change.  He received word that a large Roman force was marching from the Mediterranean coast to intercept and destroy him.  As the force outnumbered him by a significant margin, Hannibal was faced with a difficult choice.  Should he stay at his current location and engage the Roman army or retreat and prepare a defense?</p>
<p>Not content with either choice, Hannibal ultimately chose a third option; which, ironically, would have enormous consequences for his overall campaign.  To evade the Romans, Hannibal took the unprecedented action of turning inland and marching over the Alps.  (It is thought that he probably crossed over the valley of the Drome and south of the Col de Montgenevre or near the Col de Mont Cenis.)  This had never been done before – indeed many thought it impossible – and has long been praised as a brilliant tactical decision.</p>
<p>Minard’s reconstruction of Hannibal’s journey shows the journey from Spain, through Transalpine Gaul and eventual arrival in Italy, allows it to be seen a slightly different light, however.  Through use of a flow line, Minard shows how the strength of Hannibal’s army waned through the march, with a disastrous loss of twenty thousand men while passing over the Alps.  This steady loss of strength, subtly reinforced by Minard’s map, helps to explain why Hannibal failed to subdue Rome.<!--adsensestop--></p>
<p>Hannibal’s brilliant tactical decision was also a strategical disaster.  It came at a dramatic loss of men, war elephants, and material with the most disastrous loss being the destruction of his siege engines.  Without the siege engines, Hannibal was never able to successfully attack Rome.  And eventually the Romans realized this and changed their tactics.  Instead of engaging Hannibal directly, they instead fought a long-pitched war of attrition and eventually destroyed the one resource he couldn’t replace: his men.  Thus, even though crossing the Alps helped Hannibal to win a few stunning victories, the decision eventually caused him to lose the war.</p>
<p><a href="http://www.oak-tree.us/stuff/OpenSource-Writing/Minard-Hannibal.pdf"><img style="display: inline; border-width: 0px;" title="Hanibal's invasion of Italy over the Italian Alps." src="http://www.oak-tree.us/blog/wp-content/uploads/2010/02/MinardHannibal.png" border="0" alt="Hanibal's invasion of Italy over the Italian Alps." width="600" height="286" /></a></p>
<h2>Napoleon’s Invasion of Russia (1812-1813)</h2>
<p>Like in the case of the Hannibal, Minard’s depiction of the 1812-1813 invasion of Russia also tells an extraordinary story.  It combines information about the size of the army, geography, sub-campaigns and temperature into a single narrative.  This time, though, it is anything but subtle.</p>
<p><em>Note: Because of  the elegant management of all this information – at any time showing the army’s direction, size, and loss relative to the start – some statisticians and data visualization experts (such as Edward Tufte, Etieene Jules Marey and Howard Wainer) have declared Minard’s depiction of Napoleon’s Invasion of Russia to be the greatest numerical graphic ever created.</em></p>
<p>From the very beginning, the army met with tremendous hardship.  The cold temperatures and lack of available resources took an enormous toll.  Napoleon had planned on scavenging for supplies to support his massive army, but the Russians had destroyed all of their crops and burned their villages so that Napoleon wouldn’t be able to make use of them.  As a result, the army was heavily reliant on slow supply trains from Europe that were unable to keep pace with its quick advance.  Hundreds of thousands died from starvation and exposure, greatly outnumbering those lost in combat.</p>
<p>Minard’s map shows this trend of devastating loss.  Napoleon’s Grand Army starts out as a wide, brown line to the left of the map.  As the army progresses across Russia, the number of men decreases dramatically.   A few ribbons of men are dispatched to other targets, but by far the majority succumb to the elements.</p>
<p>Eventually, a substantially reduced force (100,000 men, about 20% of those who began the campaign) arrived in Moscow.  What they found did little to improve their circumstances.  The city had been abandoned and burned to the ground.  No food was available.  The only available option was to return to France.</p>
<p>Demoralized and broken, the Grand Army began a slow retreat to the west.  Their progress is shown in the black.  As they crossed the vast Russian wilderness, the temperature turned bitter cold (shown in the bottom third of the map).  When the army arrived at the Niemen river, there were a scant 10,000 troops.  More than 400,000 had died.</p>
<p>Such a devastating loss of life crippled Napoleon’s young empire and left him open to invasion by his enemies.  He was defeated later in 1813 and exiled to the island of Elba.</p>
<p><a href="http://www.oak-tree.us/stuff/OpenSource-Writing/Minard-Napoleon.pdf"><img style="display: inline; border-width: 0px;" title="Minard's map showing Napoleon's invasion of Russia and the catastrophic losses he suffered." src="http://www.oak-tree.us/blog/wp-content/uploads/2010/02/MinardNapoleon.png" border="0" alt="Minard's map showing Napoleon's invasion of Russia and the catastrophic losses he suffered." width="600" height="292" /></a></p>
<h2>Conclusion</h2>
<p>Minard’s graphics are successful because they demonstrate powerful trends and place evidence within its proper context.  In the case of Hannibal, it shows how he began in a position of strength and then undermined himself through a brilliant tactical innovation.  In the case of Napoleon, it shows how distance and temperature ravaged an army and destroyed an emperor.</p>
<p>The clear evidence and thoughtful presentation define the story, they show where things are headed and help to foreshadow the inevitable conclusion.  For this reason, they are powerful examples of clear communication.</p>
<p>____________________________________________________</p>
<h3>Unrelated Thoughts: Re-Visioning Minard with Open Source Tools</h3>
<p>Since first seeing these charts as part of an undergraduate statistics course, I’ve been obsessed with them.  I even have a poster sized copy of the Russian invasion (available from <a href="http://www.edwardtufte.com/tufte/posters">Graphics Press</a>) hanging in my office.  Given this obsession, it should come as no surprise that I’ve wanted to include the maps in my book.</p>
<p>There is, however, just one problem; there is not anything new to say about them.  Edward Tufte has held up Minard as a “Da Vinci of Data” for the better part of thirty years.  Nearly every one of his books includes a copy of the maps (in the case of Beautiful Evidence, his most recent work, there is an entire chapter devoted to the graphics; including eight different reproductions).  Other than, “They’re beautiful, study them carefully, read Tufte’s analysis,” there just isn’t that much to say.</p>
<p>That is, until I started looking for examples of scientific illustration that could be reproduced using the vector illustration program, Inkscape. Any such example should have simple lines and clean integration of text and images.  I&#8217;m not sure that a better description of Minard&#8217;s work exists.</p>
<p>The two images above (and attendant PDFs) were my first pass at re-drawing the maps.  And I have to say, I’m rather happy with the result.  For the most part, I was able to get a very faithful reproduction (with the exception of the type face, which I deliberately changed because I hate script fonts), and only required a couple of hours worth of work.</p>
<p>I think that I may have found my book examples.  It allows me to include one of the best statistical charts of all time, talk about flow maps, and even include some interesting how-tos which show how the graphics can be built in an automated fashion.  Which, come to think of it, might just count as a new contribution after all.</p>
<h3>Acknowledgements and Further Reading</h3>
<p>More information on the book can be found at the <a href="http://rapidbooks.ca/">publisher’s website</a>.</p>
<p>The source images for the two maps included “Re-Visions of Minard” by Michael Friendly (1999) and the reproductions in “Beautiful Evidence” by Edward Tufte.  Translation for the Hannibal map was adapted from those available on <a href="http://www.edwardtufte.com/tufte/minard-hannibal">Edward Tufte’s website</a> (Dawn Finley) and sources available at <a href="http://www.math.yorku.ca/SCS/Gallery/re-minard.html">Re-Visions of Minard</a>.  Translation for the Russian campaign map were taken from the reproduction in Edward Tufte’s “Beautiful Evidence”, <a href="http://commons.wikimedia.org/wiki/File:Minard.png">Wikimedia Commons</a> and sources available from <a href="http://www.math.yorku.ca/SCS/Gallery/re-minard.html">Re-Visions of Minard</a>.</p>
<p>Additionally, the Re-Visions of Minard Website include a number of interesting adaptations of the Napoleon graphic that might be of interest, including both Matlab and GGPlot2 reconstructions.<br />
<h3>Similar Posts:</h3>
<ul class="similar-posts">
<li><a href="http://www.oak-tree.us/blog/index.php/2009/03/09/anathem" rel="bookmark" title="March 9, 2009">Anathem: Big Book, Big Ideas</a></li>
<li><a href="http://www.oak-tree.us/blog/index.php/2009/11/14/customize-lyx-character-styles" rel="bookmark" title="November 14, 2009">Customizing LyX: Character Styles and the LyX Local Layout</a></li>
<li><a href="http://www.oak-tree.us/blog/index.php/2009/03/24/af-mri" rel="bookmark" title="March 24, 2009">Heart Arrhythmias and MRI</a></li>
<li><a href="http://www.oak-tree.us/blog/index.php/2008/12/16/wpf-svg-xaml-part3" rel="bookmark" title="December 16, 2008">WPF – SVG Graphics and XAML – Part 3</a></li>
<li><a href="http://www.oak-tree.us/blog/index.php/2009/11/25/latex-cv-part1" rel="bookmark" title="November 25, 2009">Typeset Your Curriculum Vitae &ndash; Part 1: The xetexCV Document Class</a></li>
</ul>
<p><!-- Similar Posts took 16.585 ms --></p>
<p>Copywrite 2009: Rob Oakes.  <a href="http://www.oak-tree.us/blog">Apolitically Incorrect</a><br/><br/><a href="http://www.oak-tree.us/blog/index.php/2010/02/22/minard-maps">Hannibal, Napoleon, and Joseph Charles Minard</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.oak-tree.us/blog/index.php/2010/02/22/minard-maps/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>WPF – SVG Graphics and XAML – Part 3</title>
		<link>http://www.oak-tree.us/blog/index.php/2008/12/16/wpf-svg-xaml-part3</link>
		<comments>http://www.oak-tree.us/blog/index.php/2008/12/16/wpf-svg-xaml-part3#comments</comments>
		<pubDate>Tue, 16 Dec 2008 22:49:00 +0000</pubDate>
		<dc:creator>Rob Oakes</dc:creator>
				<category><![CDATA[Computer]]></category>
		<category><![CDATA[Illustration]]></category>
		<category><![CDATA[IronPython]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.oak-tree.us/blog/?p=367</guid>
		<description><![CDATA[	
	<span class="Z3988" title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Adc&amp;rfr_id=info%3Asid%2Focoins.info%3Agenerator&amp;rft.title=WPF+%E2%80%93+SVG+Graphics+and+XAML+%E2%80%93+Part+3&amp;rft.aulast=Oakes&amp;rft.aufirst=Rob&amp;rft.subject=Computer&amp;rft.subject=Illustration&amp;rft.subject=IronPython&amp;rft.subject=Programming&amp;rft.source=Apolitically+Incorrect&amp;rft.date=2008-12-16&amp;rft.type=blogPost&amp;rft.format=text&amp;rft.identifier=http://www.oak-tree.us/blog/index.php/2008/12/16/wpf-svg-xaml-part3&amp;rft.language=English"></span>
As described in part 1 of this article, vector graphics offer a tremendous number of advantages over their raster counterparts. These benefits include the ability to enlarge the image to any size without a loss of detail or quality and better reproduction in both print and online form. Combined with the existence of many high [...]<p>Copywrite 2009: Rob Oakes.  <a href="http://www.oak-tree.us/blog">Apolitically Incorrect</a><br/><br/><a href="http://www.oak-tree.us/blog/index.php/2008/12/16/wpf-svg-xaml-part3">WPF – SVG Graphics and XAML – Part 3</a></p>
]]></description>
			<content:encoded><![CDATA[	
	<span class="Z3988" title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Adc&amp;rfr_id=info%3Asid%2Focoins.info%3Agenerator&amp;rft.title=WPF+%E2%80%93+SVG+Graphics+and+XAML+%E2%80%93+Part+3&amp;rft.aulast=Oakes&amp;rft.aufirst=Rob&amp;rft.subject=Computer&amp;rft.subject=Illustration&amp;rft.subject=IronPython&amp;rft.subject=Programming&amp;rft.source=Apolitically+Incorrect&amp;rft.date=2008-12-16&amp;rft.type=blogPost&amp;rft.format=text&amp;rft.identifier=http://www.oak-tree.us/blog/index.php/2008/12/16/wpf-svg-xaml-part3&amp;rft.language=English"></span>
<p>As described in <a href="http://www.oak-tree.us/blog/index.php/2008/12/13/wpf-svg-xaml-part1">part 1</a> of this article, <a href="http://en.wikipedia.org/wiki/Vector_graphics">vector graphics</a> offer a tremendous number of advantages over their <a href="http://en.wikipedia.org/wiki/Raster_graphics">raster</a> counterparts. These benefits include the ability to enlarge the image to any size without a loss of detail or quality and better reproduction in both print and online form. Combined with the existence of many high quality icon libraries, vector graphics represent a valuable source of art for desktop applications.</p>
<p>In <a href="http://www.oak-tree.us/blog/index.php/2008/12/14/wpf-svg-xaml-part2">part 2</a> of this article, we looked at a way to convert vector graphics using Adobe Illustrator. While useful, the XAML export plug-in has a number of limitations and is not always able to faithfully convert the image to XAML. Thus, while Adobe Illustrator is a good conversion method when working directly with artists and graphic designers who are able to provide art files in Adobe Illustrator (AI) format, it is not so well suited to existing OpenSource libraries which tend to be distributed in the SVG format.</p>
<p>Due to their use of alpha transparency, Adobe Illustrator is always able to read the images from other editors, though it contains basic SVG support. This is unfortunate as these icon libraries, such as the <a href="http://www.oxygen-icons.org/">Oxygen Icon Set</a>, are freely available under permissive licenses. Fortunately, there is a way to overcome some of these limitations. In this article, I will look at how to convert SVG icons to XAML using the stand-alone utility <a href="http://www.codeplex.com/XamlTune">XamlTune</a>. We will also be using the OpenSource SVG editor, <a href="http://www.inkscape.org/">Inkscape</a>.</p>
<p style="TEXT-ALIGN: center"><img src="http://www.oak-tree.us/blog/wp-content/uploads/2008/12/121608-2248-wpfsvggraph1.png" alt="" /><span id="more-367"></span></p>
<h2>SVG Icon Sources</h2>
<p>Prior to delving into the process by which SVG can be converted to XAML, I thought it might be good to take a minute and highlight some excellent sources of high quality SVG art. These include a number of general resources as well as dedicated SVG libraries.</p>
<h3>Wikimedia Commons</h3>
<p>One of the better art libraries can be found at <a href="http://commons.wikimedia.org/wiki/Main_Page">Wikimedia Commons</a>. It includes an enormous number of public domain and free-licensed media content with a healthy section of SVG images. Some of the more popular examples include the <a href="http://commons.wikimedia.org/wiki/Category:Nuvola_SVG_icons">Nuvola</a> and <a href="http://commons.wikimedia.org/wiki/Bluesphere_SVG_icons">Bluesphere</a> themes. The database of images is both searchable and browseable.</p>
<p>While the vast majority of the images are available in the public domain or under permissive licenses, it is important to read the specific license of each image which will be used. Even when using OpenSource artwork, the type of license is important. Images released under the GPL cannot be used in commercial projects, for example.</p>
<div style="text-align: center">
<table style="border-collapse:collapse" border="0">
<colgroup span="1">
<col style="width: 142px;" span="1"></col>
<col style="width: 134px;" span="1"></col>
<col style="width: 206px;" span="1"></col>
</colgroup>
<tbody>
<tr>
<td style="padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  none; border-bottom:  none; border-right:  none">
<p style="text-align: center"><a href="http://upload.wikimedia.org/wikipedia/commons/2/24/Nuvola_apps_konsole.png"><img src="http://www.oak-tree.us/blog/wp-content/uploads/2008/12/121608-2248-wpfsvggraph2.png" border="0" alt="" /></a></p>
</td>
<td style="padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  none; border-bottom:  none; border-right:  none">
<p style="text-align: center"><a title="&quot;Nuvola Nordic flags.svg&quot;" href="http://upload.wikimedia.org/wikipedia/commons/8/89/Nuvola_Nordic_flags.svg"><img src="http://www.oak-tree.us/blog/wp-content/uploads/2008/12/121608-2248-wpfsvggraph3.png" border="0" alt="" /></a></p>
</td>
<td style="padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  none; border-bottom:  none; border-right:  none">
<p style="text-align: center"><a href="http://upload.wikimedia.org/wikipedia/commons/2/26/Nuvola_apps_edu_mathematics-ar.svg"><img src="http://www.oak-tree.us/blog/wp-content/uploads/2008/12/121608-2248-wpfsvggraph4.png" border="0" alt="" /></a></p>
</td>
</tr>
<tr>
<td style="BORDER-RIGHT: medium none; PADDING-RIGHT: 7px; BORDER-TOP: medium none; PADDING-LEFT: 7px; BORDER-LEFT: medium none; BORDER-BOTTOM: medium none; TEXT-ALIGN: left" colspan="3"><strong>Figure 1. </strong>Sample images from the Nuvola theme at Wikimedia Commons</td>
</tr>
</tbody>
</table>
</div>
<h3>Oxygen</h3>
<p>The <a href="http://www.oxygen-icons.org/">Oxygen</a> icon theme is the default icon set for the KDE desktop. The sample artwork at the beginning of each of the parts in this series were taken from the Oxygen project. The set is licensed under both the LGPL and Creative Commons, as a result, it can be used in both commercial and OpenSource applications. There are a huge number of individual icons which cover actions, file types, and applications. Thus, between its beauty and permissive license, in addition to the fact that it is available in svg format, Oxygen is an ideal source of artwork. The Oxygen theme will be the source of the art used in this tutorial.</p>
<div style="text-align: center">
<table style="border-collapse:collapse" border="0">
<colgroup span="1">
<col style="width: 159px;" span="1"></col>
<col style="width: 159px;" span="1"></col>
<col style="width: 160px;" span="1"></col>
<col style="width: 160px;" span="1"></col>
</colgroup>
<tbody>
<tr>
<td style="padding-left: 7px; padding-right: 7px" colspan="2"><img src="http://www.oak-tree.us/blog/wp-content/uploads/2008/12/121608-2248-wpfsvggraph5.png" alt="" /></td>
<td style="padding-left: 7px; padding-right: 7px"><img src="http://www.oak-tree.us/blog/wp-content/uploads/2008/12/121608-2248-wpfsvggraph6.png" alt="" /></td>
<td style="padding-left: 7px; padding-right: 7px"><img src="http://www.oak-tree.us/blog/wp-content/uploads/2008/12/121608-2248-wpfsvggraph7.png" alt="" /></td>
<td style="padding-left: 7px; padding-right: 7px"><img src="http://www.oak-tree.us/blog/wp-content/uploads/2008/12/121608-2248-wpfsvggraph8.png" alt="" /></td>
</tr>
<tr>
<td style="PADDING-RIGHT: 7px; PADDING-LEFT: 7px; TEXT-ALIGN: left" colspan="4"><strong>Figure 2.</strong> Sample images from the Oxygen icon set.</td>
</tr>
</tbody>
</table>
</div>
<p>In contrast to the icons available at Wikimedia Commons, however, the Oxygen Icons can only be downloaded via <a href="http://subversion.tigris.org/">Subversion</a>. You will thus need either need to download the command line toolset, or a GUI client like <a href="http://tortoisesvn.tigris.org/">TortoiseSVN</a>. The Oxygen icons can be found at:</p>
<p><span style="font-family: Courier New;">    svn://anonsvn.kde.org/home/kde/trunk/KDE/kdebase/runtime/pics/oxygen/<br />
</span></p>
<p>If you are working from the command line, go to the directory where you would like to save the icons., then type:</p>
<p><span style="font-family: Courier New;">    svn co svn://anonsv.kde.org/home/kde/trunk/KDE/kdebase/runtime/pics/oxygen Oxygen<br />
</span></p>
<p>The icons will be downloaded to a folder called &#8216;Oxygen.&#8217; If you want to only download the SVG versions of the icons, use:</p>
<p><span style="font-family: Courier New;">    svn://anonsvn.kde.org/home/kde/trunk/KDE/kdebase/runtime/pics/oxygen/scalable</span></p>
<h2>Method 2: Inkscape and XamlTune</h2>
<h3>Installation<img src="http://www.oak-tree.us/blog/wp-content/uploads/2008/12/121608-2248-wpfsvggraph9.png" alt="" align="right" /></h3>
<p>To convert SVG icons using XamlTune is a two step process. You will need to have both Inkscape and Xamltune. A Windows Installer for Inkscape can be found <a href="http://www.inkscape.org/download/?lang=en">here</a>. XamlTune can be downloaded from its <a href="http://www.codeplex.com/XamlTune">CodePlex download page</a>. Click on the &#8220;Download Now&#8221; button on the right part of the page.</p>
<p>After XamlTune has downloaded, you will need to extract the binary and supporting libraries to a folder. It does not have an automatic installer. To run XamlTune, double click on XamlTune.exe. Alternatively, there is also a WebApp version, which can be found <a href="http://labs.ucaya.com/xamltune/">here</a>. The in this tutorial were converted using the desktop application.</p>
<h3>Program Use</h3>
<p>XamlTune is only able to convert well-formed SVG to XAML. When I tried converting compressed SVG (svgz), it caused the program to crash. Thus it is very important to make sure that they are plain, vanilla SVG. If they were created by Inkscape, Krita, or OpenOffice Draw this is likely not the case. All three programs use markup not part of the SVG standard to properly render and edit the images. While this additional markup is ignored by viewers, it may cause a converter to crash.</p>
<h4>Convert SVGZ to SVG</h4>
<p>The first step is to then convert the distribution format to vanilla SVG. To do so:</p>
<ol>
<li>Open Inkscape and load the file. </li>
<li>Choose <strong>File &gt; Save As</strong></li>
<li>Select the destination and provide the name of the file. In the list of file types, choose <strong>Plain SVG </strong>and then click &#8220;Ok.&#8221;</li>
</ol>
<h4>Conversion to Xaml – Desktop Application</h4>
<p>The XamlTune UI includes two windows, which are shown in figure 3 below. The first window is used for input and the second window is used for output. You can either cut and paste the SVG into the text box or load it from file. The second window contains the conversion options, the converted XAML, and a preview of the converted image. It is possible to convert to both WPF and Silverlight XAML.</p>
<p style="text-align: center"><img src="http://www.oak-tree.us/blog/wp-content/uploads/2008/12/121608-2248-wpfsvggraph10.png" alt="" /></p>
<p><strong>Figure 3. The XamlTune User Interface. </strong>There are two windows in the XamlTune UserInterface. The first is used for the data. The second window includes the conversion options, the converted XAML text and a preview of the converted image.</p>
<p>Once the image has been converted, it can be saved to the active directory by typing a filename and clicking the &#8220;<strong>Save</strong>&#8221; button. You will need to add the .xaml, as this is not done by the program automatically.</p>
<h4>Examples</h4>
<p>The examples below show images that were converted with XamlTune from plain SVG. In each case, there were significant differences between the source image and the converted XAML. The most common discrepancies were seen in shadows and complex gradients which used alpha transparency. I also noticed problems in images which made use of extensive typography, however.</p>
<p>The first example (Figure 4) is a beautiful rendering of a newspaper. It includes a number of complex gradients and makes extensive use of typography. In the exported XAML, many of the gradients were not correctly exported nor was the text.</p>
<div style="text-align: center">
<table style="border-collapse:collapse" border="0">
<colgroup span="1">
<col style="width: 352px;" span="1"></col>
<col style="width: 352px;" span="1"></col>
</colgroup>
<tbody>
<tr>
<td style="padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  none; border-bottom:  none; border-right:  none">
<p style="text-align: center"><img src="http://www.oak-tree.us/blog/wp-content/uploads/2008/12/121608-2248-wpfsvggraph11.png" alt="" /></p>
</td>
<td style="padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  none; border-bottom:  none; border-right:  none">
<p style="text-align: center"><img src="http://www.oak-tree.us/blog/wp-content/uploads/2008/12/121608-2248-wpfsvggraph12.png" alt="" /></p>
</td>
</tr>
<tr>
<td style="padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  none; border-bottom:  none; border-right:  none"><img src="http://www.oak-tree.us/blog/wp-content/uploads/2008/12/121608-2248-wpfsvggraph13.png" alt="" /></td>
<td style="padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  none; border-bottom:  none; border-right:  none"><img src="http://www.oak-tree.us/blog/wp-content/uploads/2008/12/121608-2248-wpfsvggraph14.png" alt="" /></td>
</tr>
<tr>
<td style="BORDER-RIGHT: medium none; PADDING-RIGHT: 7px; BORDER-TOP: medium none; PADDING-LEFT: 7px; BORDER-LEFT: medium none; BORDER-BOTTOM: medium none; TEXT-ALIGN: left" colspan="2"><strong>Figure 4. </strong>The top panels show how the original SVG image appears in Inkscape. The detail at right has been zoomed to 400% of the original size. The bottom panel shows the XAML created by XamlTune. While most of the gradients and much of the illustration was converted without difficulty, the fonts and type were ignored.</td>
</tr>
</tbody>
</table>
</div>
<p>In the second example (Figure 5) shows similar issues as the first. The color effects on the controls in addition to the shadows were not correctly exported. Other elements were shifted from their original location, which suggests that there may be an issue in keeping track of coordinates.</p>
<div style="text-align: center">
<table style="border-collapse:collapse" border="0">
<colgroup span="1">
<col style="width: 319px;" span="1"></col>
<col style="width: 319px;" span="1"></col>
</colgroup>
<tbody>
<tr>
<td style="padding-left: 7px; padding-right: 7px"><img src="http://www.oak-tree.us/blog/wp-content/uploads/2008/12/121608-2248-wpfsvggraph15.png" alt="" /></td>
<td style="padding-left: 7px; padding-right: 7px"><img src="http://www.oak-tree.us/blog/wp-content/uploads/2008/12/121608-2248-wpfsvggraph16.png" alt="" /></td>
</tr>
<tr>
<td style="PADDING-RIGHT: 7px; PADDING-LEFT: 7px; TEXT-ALIGN: left" colspan="2"><strong>Figure 5.</strong> In this example, it is possible to notice some distortion in the converted Xaml. Some of the gradients were not properly converted and some of the controls have shifted location. The shadows have also not been correctly rendered.</td>
</tr>
</tbody>
</table>
</div>
<p>In this third example, we see a complex example with gradients, shadows and lettering. Again, there are major discrepancies between the source image (left) and the exported XAML. In addition, there is also some distortion of the chip body.</p>
<div style="text-align: center">
<table style="border-collapse:collapse" border="0">
<colgroup span="1">
<col style="width: 319px;" span="1"></col>
<col style="width: 319px;" span="1"></col>
</colgroup>
<tbody>
<tr>
<td style="padding-left: 7px; padding-right: 7px"><img src="http://www.oak-tree.us/blog/wp-content/uploads/2008/12/121608-2248-wpfsvggraph17.png" alt="" /></td>
<td style="padding-left: 7px; padding-right: 7px" valign="middle">
<p style="text-align: center"><img src="http://www.oak-tree.us/blog/wp-content/uploads/2008/12/121608-2248-wpfsvggraph18.png" alt="" /></p>
</td>
</tr>
<tr>
<td style="PADDING-RIGHT: 7px; PADDING-LEFT: 7px; TEXT-ALIGN: left" colspan="2"><strong>Figure 6.</strong> As in previous examples, there are some major inconsistencies between the source image and the converted XAML. Shadows and some gradients did not transfer correctly. The background image of an X on the top of the chip was also omitted.</td>
</tr>
</tbody>
</table>
</div>
<h2>Conclusion</h2>
<p>Much like XAML created with the Adobe Illustrator plug-in, there are often discrepancies between the source SVG and the final image. XamlTune struggled to consistently portray complex gradients (making use of alpha transparency) as well as to properly render shadows. Simpler images which lack these elements appeared to export without distortion. While not a perfect solution, both techniques allow for SVG assets to be converted to XAML and used in both WPF and Silverlight applications.<br />
<h3>Similar Posts:</h3>
<ul class="similar-posts">
<li><a href="http://www.oak-tree.us/blog/index.php/2008/12/14/wpf-svg-xaml-part2" rel="bookmark" title="December 14, 2008">WPF – SVG Graphics and XAML – Part 2</a></li>
<li><a href="http://www.oak-tree.us/blog/index.php/2008/12/13/wpf-svg-xaml-part1" rel="bookmark" title="December 13, 2008">WPF – SVG Graphics and XAML – Part 1</a></li>
<li><a href="http://www.oak-tree.us/blog/index.php/2008/12/01/ironpython-part5" rel="bookmark" title="December 1, 2008">Learning IronPython – Part 5 – A Rudimentary Download Manager</a></li>
<li><a href="http://www.oak-tree.us/blog/index.php/2009/07/07/backup-part5-2" rel="bookmark" title="July 7, 2009">Backup, Sync and Share &ndash; Part 5.2: Windows Vista Backup (Disaster Prevention)</a></li>
<li><a href="http://www.oak-tree.us/blog/index.php/2009/01/06/ironpython-databinding1" rel="bookmark" title="January 6, 2009">IronPython &#8211; Data Binding and Data Templates &#8211; Part 1</a></li>
</ul>
<p><!-- Similar Posts took 23.101 ms --></p>
<p>Copywrite 2009: Rob Oakes.  <a href="http://www.oak-tree.us/blog">Apolitically Incorrect</a><br/><br/><a href="http://www.oak-tree.us/blog/index.php/2008/12/16/wpf-svg-xaml-part3">WPF – SVG Graphics and XAML – Part 3</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.oak-tree.us/blog/index.php/2008/12/16/wpf-svg-xaml-part3/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>WPF – SVG Graphics and XAML – Part 2</title>
		<link>http://www.oak-tree.us/blog/index.php/2008/12/14/wpf-svg-xaml-part2</link>
		<comments>http://www.oak-tree.us/blog/index.php/2008/12/14/wpf-svg-xaml-part2#comments</comments>
		<pubDate>Sun, 14 Dec 2008 05:34:38 +0000</pubDate>
		<dc:creator>Rob Oakes</dc:creator>
				<category><![CDATA[Computer]]></category>
		<category><![CDATA[Illustration]]></category>
		<category><![CDATA[IronPython]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.oak-tree.us/blog/?p=342</guid>
		<description><![CDATA[	
	<span class="Z3988" title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Adc&amp;rfr_id=info%3Asid%2Focoins.info%3Agenerator&amp;rft.title=WPF+%E2%80%93+SVG+Graphics+and+XAML+%E2%80%93+Part+2&amp;rft.aulast=Oakes&amp;rft.aufirst=Rob&amp;rft.subject=Computer&amp;rft.subject=Illustration&amp;rft.subject=IronPython&amp;rft.subject=Programming&amp;rft.source=Apolitically+Incorrect&amp;rft.date=2008-12-14&amp;rft.type=blogPost&amp;rft.format=text&amp;rft.identifier=http://www.oak-tree.us/blog/index.php/2008/12/14/wpf-svg-xaml-part2&amp;rft.language=English"></span>
In part 1 of this article, I introduced some of the difficulties in converting SVG graphics to WPF XAML. These included inconsistent implementations across SVG editors and the lack of a high quality XAML export. I also introduced two methods for the conversion of vector graphics to XAML. The first uses Adobe Illustrator and the [...]<p>Copywrite 2009: Rob Oakes.  <a href="http://www.oak-tree.us/blog">Apolitically Incorrect</a><br/><br/><a href="http://www.oak-tree.us/blog/index.php/2008/12/14/wpf-svg-xaml-part2">WPF – SVG Graphics and XAML – Part 2</a></p>
]]></description>
			<content:encoded><![CDATA[	
	<span class="Z3988" title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Adc&amp;rfr_id=info%3Asid%2Focoins.info%3Agenerator&amp;rft.title=WPF+%E2%80%93+SVG+Graphics+and+XAML+%E2%80%93+Part+2&amp;rft.aulast=Oakes&amp;rft.aufirst=Rob&amp;rft.subject=Computer&amp;rft.subject=Illustration&amp;rft.subject=IronPython&amp;rft.subject=Programming&amp;rft.source=Apolitically+Incorrect&amp;rft.date=2008-12-14&amp;rft.type=blogPost&amp;rft.format=text&amp;rft.identifier=http://www.oak-tree.us/blog/index.php/2008/12/14/wpf-svg-xaml-part2&amp;rft.language=English"></span>
<p>In <a href="http://www.oak-tree.us/blog/index.php/2008/12/13/wpf-svg-xaml-part1">part 1</a> of this article, I introduced some of the difficulties in converting SVG graphics to WPF XAML. These included inconsistent implementations across SVG editors and the lack of a high quality XAML export. I also introduced two methods for the conversion of vector graphics to XAML. The first uses Adobe Illustrator and the second makes use of free standalone program called XamlTune. In this article will take a detailed look at the first of these methods. In part 3, we will look at the second method.</p>
<p style="text-align: center;"><img src="http://www.oak-tree.us/blog/wp-content/uploads/2008/12/121408-0533-wpfsvggraph1.png" alt="" /><span id="more-342"></span></p>
<h2>Method 1: Adobe Illustrator</h2>
<p>When working on most vector graphics projects, there is really only one software program that really matters: Adobe Illustrator. While I&#8217;d like to say it is the 800 pound gorilla in the room, it is probably more accurate to say it is the only gorilla in the room. Given its near omnipresence in the artistic community, it is hugely convenient that there is a <a href="http://www.mikeswanson.com/XAMLExport/default.htm">highly capable plug-in</a> which can export high quality XAML directly from Illustrator.</p>
<h3>Installation</h3>
<p>Installation of the plug-in is simple and straightforward. You can find it at <a href="http://www.mikeswanson.com/XAMLExport/default.htm">MikeSwanson.com</a>, under XamlExport. After it has been downloaded, unzip it to the Illustrator Illustrator plug-in folder. For a Windows default installation of Create Suite CS3, the path is <strong>C:\Program Files\Adobe\Adobe Illustrator CS3\Plug-ins</strong>. If you don&#8217;t have access to the administrator account on your computer or if you prefer to install to an alternate location, that is also possible. Go to <strong>Edit &gt; Preferences &gt; Plug-ins &amp; Scratch Disks</strong> and put a check in the &#8220;Additional Plug-ins Folder.&#8221; You can then specify a folder other than the default.</p>
<p style="text-align: center"><img src="http://www.oak-tree.us/blog/wp-content/uploads/2008/12/121408-0533-wpfsvggraph2.png" alt="" /></p>
<p>Once you have copied the XAMLExport.aip file to the proper folder, you will need to restart Adobe Illustrator. The export to XAML option can be found under <strong>File &gt; Export</strong>. There will be options to export to both Windows Presentation Foundation XAML and Silverlight XAML. The export plug-in works with Adobe Illustrator CS, CS2 or CS3.</p>
<p style="text-align: center"><img src="http://www.oak-tree.us/blog/wp-content/uploads/2008/12/121408-0533-wpfsvggraph3.png" alt="" /></p>
<h3>Plug-In Use</h3>
<p>Using the plug-in, it is possible to export any file which Illustrator is capable of reading. This includes AI files, Illustrator compatible SVG files, and PDF files. The size of the exported images is adjusted by changing the document properties, found under <strong>File &gt; Document Setup.</strong></p>
<p>While the plugin will work on all file types, not all of the features of Adobe Illustrator are supported. Mark Swenson gives a detailed list at the <a href="http://www.mikeswanson.com/XAMLExport/default.htm">download site</a>, but there are a few import limitations that should be mentioned.</p>
<ol>
<li>Text Export. In the current implementation, there is no support for WPF native text rendering. While it is possible to work around this limitation by choosing <strong>Select &gt; Object &gt; Text Objects</strong> then changing the text to an outline prior to performing the export (<strong>Type &gt; Create Outlines</strong>), this is an imperfect solution.</li>
<li>Raster Images. There is no support for raster images that are part of the AI image. Illustrator images that incorporate any Photoshop documents or other bitmap style objects will not export correctly.</li>
<li>Illustrator Meshes. Illustrator meshes cannot be exported and will be ignored in the final output.</li>
</ol>
<p>While the lack of text and raster image support prevent the export plug-in from rendering XAML that is 100% identical to the source image, it nonetheless produces high quality output from most Adobe Illustrator objects. I experimented with a number of logos and design elements with generally good results, though there were some issues with complex paths and gradients. Some examples are shown below.</p>
<h3>Examples</h3>
<p>In the first example (Figure 1), I have used a simple logo from the <a href="http://hodad.sci.utah.edu/">Scientific Computing Institute (SCI)</a> at the University of Utah. A screenshot of the original as it appears in Illustrator is shown (top left panel) as well as two different exports. The first time I performed the export (seen in the top right panel), I did not first convert the text elements to outlines. As a result, the lettering was not converted to XAML correctly. In the second export (bottom panel), I converted the lettering to an outline prior to the export.</p>
<div style="text-align: center; margin-left: 42pt">
<table style="border-collapse:collapse" border="0">
<colgroup span="1">
<col style="width: 291px;" span="1"></col>
<col style="width: 291px;" span="1"></col>
</colgroup>
<tbody>
<tr>
<td style="padding-left: 7px; padding-right: 7px"><img src="http://www.oak-tree.us/blog/wp-content/uploads/2008/12/121408-0533-wpfsvggraph4.png" alt="" /></td>
<td style="padding-left: 7px; padding-right: 7px"><img src="http://www.oak-tree.us/blog/wp-content/uploads/2008/12/121408-0533-wpfsvggraph5.png" alt="" /></td>
</tr>
<tr>
<td style="padding-left: 7px; padding-right: 7px" colspan="2">
<p style="text-align: center"><img src="http://www.oak-tree.us/blog/wp-content/uploads/2008/12/121408-0533-wpfsvggraph6.png" alt="" /></p>
<p style="text-align: left;"><strong>Figure 1. Original SCI Logo (top left) and XAML Export from Adobe Illustrator. </strong>In the first instance (top right), the text was not changed to an outline prior to export. As a result, it was ignored. In the second instance (bottom), the text was transformed prior to export.</p>
</td>
</tr>
</tbody>
</table>
</div>
<p>In a second example (Figure 2), we see an example where an icon contains unsupported elements. While most of the image is faithfully rendered, there are two major issues. First, an error occurred when rendering the color of the inner path, which is supposed to white. This region appears as an off grey in the XAML. There was also an issue with the beautiful blue to violet gradient on the left of the image. In the XAML, it is rendered as a single color.</p>
<div style="text-align: center">
<table style="border-collapse:collapse" border="0">
<colgroup span="1">
<col style="width: 351px;" span="1"></col>
<col style="width: 265px;" span="1"></col>
</colgroup>
<tbody>
<tr style="height: 324px;">
<td style="padding-left: 7px; padding-right: 7px"><img src="http://www.oak-tree.us/blog/wp-content/uploads/2008/12/121408-0533-wpfsvggraph7.png" alt="" /></td>
<td style="padding-left: 7px; padding-right: 7px">
<p style="text-align: center"><img src="http://www.oak-tree.us/blog/wp-content/uploads/2008/12/121408-0533-wpfsvggraph8.png" alt="" /></p>
</td>
</tr>
<tr style="height: 69px;">
<td style="padding-right: 7px; padding-left: 7px; text-align: left;" colspan="2"><strong>Figure 2. Amarok Icon. </strong>The image at left shows the original artwork in Adobe Illustrator and the image at right shows the exported XAML. There are two problems in the export. The center path is no longer white and the blue to violet gradient now appears as a solid band of light blue.</td>
</tr>
</tbody>
</table>
</div>
<p>Figure 3 shows a particularly complex example which was rendered without any issues. The original image was created from a photo using Illustrator&#8217;s <a href="http://graphicssoft.about.com/od/illustrator/ss/sflivetrace.htm">LiveTrace</a> feature. The image contains hundreds of individual paths, gradients and other elements. Yet, despite its complexity, it was rendered to XAML without problem.</p>
<div style="text-align: center">
<table style="border-collapse:collapse" border="0">
<colgroup span="1">
<col style="width: 351px;" span="1"></col>
<col style="width: 265px;" span="1"></col>
</colgroup>
<tbody>
<tr style="height: 324px;">
<td style="padding-left: 7px; padding-right: 7px"><img src="http://www.oak-tree.us/blog/wp-content/uploads/2008/12/121408-0533-wpfsvggraph9.png" alt="" /></td>
<td style="padding-left: 7px; padding-right: 7px">
<p style="text-align: center"><img src="http://www.oak-tree.us/blog/wp-content/uploads/2008/12/121408-0533-wpfsvggraph10.png" alt="" /></p>
</td>
</tr>
<tr style="height: 69px;">
<td style="padding-right: 7px; padding-left: 7px; text-align: left;" colspan="2"><strong>Figure 3. XAML export of an Illustrator LiveTrace Image. </strong>Even though the image contains hundreds of paths and complex elements, the XAML export is an extremely good representation of the original image.</td>
</tr>
</tbody>
</table>
</div>
<p style="text-align: center"> </p>
<h2>Summary</h2>
<p>The XAML exporter plug-in provides high quality XAML directly from Adobe Illustrator without requiring any intermediate steps. This is convenient due to the near omnipresence of the Adobe products among artists and designers. However, the plug-in also has some serious limitations. It is not able to export native text and may have issues with complex gradients.</p>
<p>In Part 3, I will look at using XamlTune, a standalone converter utility.</p>
<p>_____________________________________________________</p>
<h2>Acknowledgements, References and Further Reading</h2>
<h3>Further Reading</h3>
<p>There is <a href="http://channel9.msdn.com/posts/scobleizer/Mike-Swanson-Adobe-Illustrator-to-XAML-converter/">25 minute video</a> which explains the basic use and function of the XAML export plug-in. It is hosted on <a href="http://channel9.msdn.com/">MSDN Channel09</a>.</p>
<h3>Legal Acknowledgements</h3>
<p>The logo of the Scientific Computing Institute is copywrite (2008) by the University of Utah. It may not be used for commercial purposes without written permission from the University of Utah. <span style="color: #333333;">The <a href="http://www.oxygen-icons.org/?page_id=4"></a></span>Oxygen Icon Theme<span style="color: #333333;"> is dual licensed under the <a href="http://creativecommons.org/licenses/by-nc-nd/2.5/"></a></span>Creative Common Attribution-ShareAlike 3.0 License<span style="color: #333333;"> as well as the <a href="http://www.gnu.org/licenses/lgpl.html"></a></span>GNU Lesser General Public License<span style="color: #333333;">.</span><br />
<h3>Similar Posts:</h3>
<ul class="similar-posts">
<li><a href="http://www.oak-tree.us/blog/index.php/2008/12/16/wpf-svg-xaml-part3" rel="bookmark" title="December 16, 2008">WPF – SVG Graphics and XAML – Part 3</a></li>
<li><a href="http://www.oak-tree.us/blog/index.php/2008/12/13/wpf-svg-xaml-part1" rel="bookmark" title="December 13, 2008">WPF – SVG Graphics and XAML – Part 1</a></li>
<li><a href="http://www.oak-tree.us/blog/index.php/2009/07/07/backup-part5-2" rel="bookmark" title="July 7, 2009">Backup, Sync and Share &ndash; Part 5.2: Windows Vista Backup (Disaster Prevention)</a></li>
<li><a href="http://www.oak-tree.us/blog/index.php/2008/12/01/ironpython-part5" rel="bookmark" title="December 1, 2008">Learning IronPython – Part 5 – A Rudimentary Download Manager</a></li>
<li><a href="http://www.oak-tree.us/blog/index.php/2009/07/30/time-traveler" rel="bookmark" title="July 30, 2009">A Better Previous Versions: Time Traveler</a></li>
</ul>
<p><!-- Similar Posts took 17.605 ms --></p>
<p>Copywrite 2009: Rob Oakes.  <a href="http://www.oak-tree.us/blog">Apolitically Incorrect</a><br/><br/><a href="http://www.oak-tree.us/blog/index.php/2008/12/14/wpf-svg-xaml-part2">WPF – SVG Graphics and XAML – Part 2</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.oak-tree.us/blog/index.php/2008/12/14/wpf-svg-xaml-part2/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>WPF – SVG Graphics and XAML – Part 1</title>
		<link>http://www.oak-tree.us/blog/index.php/2008/12/13/wpf-svg-xaml-part1</link>
		<comments>http://www.oak-tree.us/blog/index.php/2008/12/13/wpf-svg-xaml-part1#comments</comments>
		<pubDate>Sat, 13 Dec 2008 23:35:31 +0000</pubDate>
		<dc:creator>Rob Oakes</dc:creator>
				<category><![CDATA[Computer]]></category>
		<category><![CDATA[Illustration]]></category>
		<category><![CDATA[IronPython]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.oak-tree.us/blog/?p=309</guid>
		<description><![CDATA[	
	<span class="Z3988" title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Adc&amp;rfr_id=info%3Asid%2Focoins.info%3Agenerator&amp;rft.title=WPF+%E2%80%93+SVG+Graphics+and+XAML+%E2%80%93+Part+1&amp;rft.aulast=Oakes&amp;rft.aufirst=Rob&amp;rft.subject=Computer&amp;rft.subject=Illustration&amp;rft.subject=IronPython&amp;rft.subject=Programming&amp;rft.source=Apolitically+Incorrect&amp;rft.date=2008-12-13&amp;rft.type=blogPost&amp;rft.format=text&amp;rft.identifier=http://www.oak-tree.us/blog/index.php/2008/12/13/wpf-svg-xaml-part1&amp;rft.language=English"></span>
In a perfect world, most would be judged on the quality of their ideas and depth of character. However, more often they are judged by looks and dress.  What is true in the world of people is also true in the world of software. More than one website, computer program, or presentation has suffered because [...]<p>Copywrite 2009: Rob Oakes.  <a href="http://www.oak-tree.us/blog">Apolitically Incorrect</a><br/><br/><a href="http://www.oak-tree.us/blog/index.php/2008/12/13/wpf-svg-xaml-part1">WPF – SVG Graphics and XAML – Part 1</a></p>
]]></description>
			<content:encoded><![CDATA[	
	<span class="Z3988" title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Adc&amp;rfr_id=info%3Asid%2Focoins.info%3Agenerator&amp;rft.title=WPF+%E2%80%93+SVG+Graphics+and+XAML+%E2%80%93+Part+1&amp;rft.aulast=Oakes&amp;rft.aufirst=Rob&amp;rft.subject=Computer&amp;rft.subject=Illustration&amp;rft.subject=IronPython&amp;rft.subject=Programming&amp;rft.source=Apolitically+Incorrect&amp;rft.date=2008-12-13&amp;rft.type=blogPost&amp;rft.format=text&amp;rft.identifier=http://www.oak-tree.us/blog/index.php/2008/12/13/wpf-svg-xaml-part1&amp;rft.language=English"></span>
<p style="text-align: left;">In a perfect world, most would be judged on the quality of their ideas and depth of character. However, more often they are judged by looks and dress.  What is true in the world of people is also true in the world of software. More than one website, computer program, or presentation has suffered because it is unattractive. In the inevitable fight between style and substance, substance often exerts more than its fair share of influence.</p>
<p>Given the importance of stylistic presentation, it is somewhat ironic that one of the most neglected components of many software projects it that of the artwork. While the code may be carefully vetted and analyzed, often icons and other artwork are chosen at the last stage of the design. While this might be unfortunate, it is due to an important reality: high quality artwork can be very, very expensive.</p>
<p>Fortunately, there are a number of beautiful graphics libraries that are either cheap or free of charge. Most are available under permissive or OpenSource licenses and can even be used in commercial products. There is just one problem; nearly all of these libraries are available in formats which don&#8217;t play nicely with WPF and XAML. With a little bit of planning and strategy, however, it isn&#8217;t too difficult to use these resources in your own applications.<span style="font-family: Consolas;"><br />
</span></p>
<p style="text-align: center"><a href="http://www.oxygen-icons.org/?cat=3"><img src="http://www.oak-tree.us/blog/wp-content/uploads/2008/12/121308-2334-wpfsvggraph12.png" border="0" alt="" /></a><span id="more-309"></span></p>
<h2>Working with Vector Graphics</h2>
<p>While there are a huge number of beautifully done vector graphics, it is important to understand a few basic things about vector images prior to working with them. These include how they are both similar to and different from traditional graphics formats, as well as some practical limitations and realities. It is also important to know which programs you will be working with. SVG vector graphics created in one program can&#8217;t always be opened in another editor.</p>
<h3>Traditional Image Formats Versus SVG: What Are the Differences?</h3>
<p>Anyone who works with computers is familiar with the familiar types of image formats: jpeg, png, bmp, etc. These are the file types that come from digital cameras, scanners, and <a href="http://en.wikipedia.org/wiki/Raster_graphics">raster</a> based graphics programs (such as Photoshop). A raster graphic is composed of a collection of (usually) rectangular pixels. In black and white images, there is value at each pxiel that describes the intensity. A value of zero corresponds to black while large values correspond to white. Values in the middle are differing shades of grey. Color images, in contrast are coded by values that correspond to red, green, or blue. These disparate values are then mixed to arrive at the final shade. Programs such as Photoshop and the GIMP edit the individual pixel values.</p>
<div>
<table style="border-collapse:collapse; padding-right:10px" border="0" align="left">
<colgroup span="1">
<col style="width: 318px;" span="1"></col>
</colgroup>
<tbody>
<tr>
<td style="padding-left: 7px; padding-right: 7px"><a href="http://en.wikipedia.org/wiki/Image:Rgb-raster-image.png"><img src="http://www.oak-tree.us/blog/wp-content/uploads/2008/12/121308-2334-wpfsvggraph22.png" border="0" alt="" /></a></td>
</tr>
<tr>
<td style="padding-left: 7px; padding-right: 7px; padding-bottom: 7px; "><strong>Figure 1. Example of a Raster Based Graphic</strong>. Raster images are composed of arrays of pixels. At each pixel location, there is a value that corresponds to the color of the pixel. Image Source: <a href="http://en.wikipedia.org/wiki/Image:Rgb-raster-image.png">Wikipedia</a>.</td>
</tr>
</tbody>
</table>
</div>
<p>Raster images are dependent on the resolution which they are displayed. As can be seen in the example (Figure 1), the image looks better at low resolution. When it is enlarged to a high resolution, it becomes blurry.</p>
<p>In contrast to raster images, vector images are based on mathematical models. They combine different geometrical elements (such as points, lines, curves, shapes, etc) to describe the shape and color of the final drawing. They also make it easier to use a variety of advanced filters and processing tricks to generate effects such as transparency or light.</p>
<p>Vector images also offer another important benefit over raster images. They can be enlarged without a loss of quality. Figure 2 illustrates this point; it show how a vector image appears when it is enlarged. A bitmap, enlarged to the same size, is also shown for comparison</p>
<h3>Limitations and Realities</h3>
<p>While SVG has been adopted as an official W3C standard, it has never been really endorsed by any of the major software developers (which is ironic since it was initially developed and advocated by Adobe). This has led to a large number of parallel implementations, on both the proprietary and OpenSource sides of the fence. In addition to parallel implementations, SVG has suffered from limited penetration. The most common type of vector graphics in the art world isn&#8217;t SVG, but rather the native file format of Adobe Illustrator, AI.</p>
<p>To further complicate things, many of the programs which read SVG files support different parts of the specification. While Adobe Illustrator can export directly to XAML through use of a plugin, the most common version of Illustrator (CS3) uses a rather basic implementation of the SVG standard. It lacks support for alpha channels and other advanced features, which makes it impossible to open images from other SVG editors.</p>
<p>It doesn&#8217;t get much better from the OpenSource side of the fence either. File conversion and portability might charitably be described as &#8220;promising.&#8221; The most popular editor, <a href="http://www.inkscape.org/">Inkscape</a>, implements most of the features available in the WC3 standard; it doesn&#8217;t, however, play nicely with other programs. It includes its own extensions to the file format. While these extensions should effect image portability in theory, I found otherwise in practice. In multiple tests, I was not able to export images to a format which could be read by Illustrator or other OpenSource editors. And while Inkscape has a plugin to export XAML directly, the output is garbled and unusable. Other OpenSource programs, such as OpenOffice Draw and Krita, offer only very basic support for the file format and are still under active development.</p>
<div>
<table style="border-collapse:collapse; padding-left:10px" border="0" align="right">
<colgroup span="1">
<col style="width: 379px;" span="1"></col>
</colgroup>
<tbody>
<tr>
<td style="padding-right: 7px; padding-left: 7px; text-align: center;"><img src="http://www.oak-tree.us/blog/wp-content/uploads/2008/12/121308-2334-wpfsvggraph32.png" alt="" /></td>
</tr>
<tr style="height: 102px;">
<td style="padding-left: 7px; padding-right: 7px; border-top:  none; border-left:  none; border-bottom:  none; border-right:  none"><strong>Figure 2. Example of a Vector Based Graphic. </strong>Vector graphics are composed of different geometrical shapes (points, lines, curves, etc) to describe the shape and color of final image. Vector graphics can be scaled to any size without losing any quality. Image Source: <a href="http://en.wikipedia.org/wiki/File:VectorBitmapExample.png">Wikipedia</a>.</td>
</tr>
</tbody>
</table>
</div>
<p>Microsoft is hardly a champion of interoperability either. There is only one program which can read and write XAML files directly; Microsoft&#8217;s own <a href="http://www.gnu.org/licenses/lgpl.html">Expression Suite</a>. In a rather egregious oversight, the Expression suite lacks an easy way to import SVG and directly convert it to XAML.</p>
<p>So while WPF includes support both raster and vector images, many of the more advanced features of WPF (including resolution independence) really need vec tor graphics to function properly and getting the more common SVG file formats (.ai and .svg) converted to XAML can be difficult.</p>
<h3>The Solutions</h3>
<p>Luckily, however, there are two ways to successfully convert SVG to XAML. Determining which method to use largely depends on the source of the file.</p>
<ol>
<li>The first uses an Adobe Illustrator <a href="http://blogs.msdn.com/mswanson/archive/2005/07/12/438178.aspx">plugin</a> to export AI files too XAML. This method should be used when working with professional artists or graphic designers (who are likely to use the Creative Suite of Applications).</li>
<li>The second makes use of a free standalone program (<a href="http://www.codeplex.com/XamlTune">XamlTune</a>) to convert properly formatted SVG to XAML. This process makes the most sense when using existing OpenSource libraries or other freely available samples.</li>
</ol>
<p>In the next article in this series, I will look at these two methods in depth.</p>
<p>_____________________________________________________</p>
<h2>Acknowledgements, References and Further Reading</h2>
<h3>Additional Reading</h3>
<p style="text-align: justify">There is an <a href="http://weblogs.asp.net/jgalloway/archive/2007/06/05/silverlight-and-xaml-have-you-guys-met-old-man-svg.aspx">overview</a> of why WPF uses a different specification than SVG to display vector graphics on <a href="http://weblogs.asp.net/jgalloway/default.aspx">Jon Galloway&#8217;s blog</a>.</p>
<p style="text-align: justify">Mike Swanson, author of the <a href="http://www.mikeswanson.com/XAMLExport/">XAML Adobe Illustrator Plugin</a>, has a dedicated page which describes the installation and limitations of the plug-in. This includes a <a href="http://www.mikeswanson.com/XAMLExport/Eye%20Candy.htm">sample gallery</a> with a number of complex examples.</p>
<p>On <a href="http://www.uxpassion.com/">UXPassion</a>, there is a tutorial about how to convert to XAML using a <a href="http://www.uxpassion.com/2008/10/how-to-convert-svg-to-xaml-and-use-it-in-silverlight-or-wpf/">PDF intermediary</a>.</p>
<h3>Legal</h3>
<p style="text-align: justify">The image examples in this tutorial were taken from Wikipedia and are available in the Public Domain. The logos and images of the <a href="http://www.sci.utah.edu/">Scientific Computing Institute</a> (SCI) are copyrighted (2008) by the University of <a href="http://www.carinsurancerates.com/states/224-utah-car-insurance.html">Utah</a>. They may not be used for commercial purposes without written permission from the University of Utah. The <a href="http://www.oxygen-icons.org/?page_id=4">Oxygen Icon Theme</a> is dual licensed under the <a href="http://creativecommons.org/licenses/by-nc-nd/2.5/">Creative Common Attribution-ShareAlike 3.0 License</a> as well as the <a href="http://www.gnu.org/licenses/lgpl.html">GNU Lesser General Public License</a>.</p>
<h3>Similar Posts:</h3>
<ul class="similar-posts">
<li><a href="http://www.oak-tree.us/blog/index.php/2008/12/14/wpf-svg-xaml-part2" rel="bookmark" title="December 14, 2008">WPF – SVG Graphics and XAML – Part 2</a></li>
<li><a href="http://www.oak-tree.us/blog/index.php/2008/12/16/wpf-svg-xaml-part3" rel="bookmark" title="December 16, 2008">WPF – SVG Graphics and XAML – Part 3</a></li>
<li><a href="http://www.oak-tree.us/blog/index.php/2009/01/25/backup-part2" rel="bookmark" title="January 25, 2009">Backup, Share and Sync &ndash; Part 2: Hard Drive Preparation and Server Configuration</a></li>
<li><a href="http://www.oak-tree.us/blog/index.php/2009/07/07/backup-part5-2" rel="bookmark" title="July 7, 2009">Backup, Sync and Share &ndash; Part 5.2: Windows Vista Backup (Disaster Prevention)</a></li>
<li><a href="http://www.oak-tree.us/blog/index.php/2009/01/06/ironpython-databinding1" rel="bookmark" title="January 6, 2009">IronPython &#8211; Data Binding and Data Templates &#8211; Part 1</a></li>
</ul>
<p><!-- Similar Posts took 25.928 ms --></p>
<p>Copywrite 2009: Rob Oakes.  <a href="http://www.oak-tree.us/blog">Apolitically Incorrect</a><br/><br/><a href="http://www.oak-tree.us/blog/index.php/2008/12/13/wpf-svg-xaml-part1">WPF – SVG Graphics and XAML – Part 1</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.oak-tree.us/blog/index.php/2008/12/13/wpf-svg-xaml-part1/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
