{"id":926,"date":"2010-09-10T17:04:34","date_gmt":"2010-09-10T17:04:34","guid":{"rendered":"http:\/\/www.codedread.com\/blog\/?p=926"},"modified":"2010-09-10T17:08:28","modified_gmt":"2010-09-10T17:08:28","slug":"new-shit-has-come-to-light","status":"publish","type":"post","link":"https:\/\/www.codedread.com\/blog\/archives\/2010\/09\/10\/new-shit-has-come-to-light\/","title":{"rendered":"New Shit Has Come To Light"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" width=\"100\" height=\"100\" style=\"float:right\" src=\"http:\/\/codedread.com\/clipart\/beer-mug.svgz\" alt=\"I want to believe. SVG as an image format.\"><\/img>Those wacky Mozilla <a href=\"http:\/\/blog.dholbert.org\/\" title=\"Ok, just one guy, Daniel, but he had help reviewing!\">guys<\/a> just fixed <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=276431\">a bug<\/a> I've been waiting years for:  They now support SVG in &#60;img&#62; tags (and in most image contexts, for example background-image).  This will be available in Firefox 4 Beta 6 and beyond (or <a href=\"http:\/\/ftp.mozilla.org\/pub\/mozilla.org\/firefox\/nightly\/latest-trunk\/\">download a nightly<\/a>).<!--more--><\/p>\n<p>See SVG really has two roles on the web scene:  as document and as image.  For a long time I've been really excited about SVG-as-a-document because web documents have a DOM, are scriptable, can be styled, have semantics - that goody bag is really stuffed.  I've been less excited about SVG-as-an-image because frankly it hardly worked anywhere and I had no prospect of the situation improving.  Now that Firefox is finally onboard and IE9 is waiting in the wings we are about to embark on a new era of capabilities for the web that we can begin to rely on in less than a year.<\/p>\n<p>Why is it important?<\/p>\n<p>For one, SVG-as-an-image means that your images scale perfectly at any screen resolution.  This will generally mean crisper images than their uncouth raster cousins with no lossiness.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"100\" height=\"100\" style=\"float:right\" src=\"http:\/\/codedread.com\/clipart\/tools.svgz\" alt=\"I want to believe. SVG as an image format.\"><\/img>For two, SVG images <em>can<\/em> be smaller in size than their equivalent raster counterpart (especially when gzipped).  This is dependent upon the level of detail you've put into the image and the tools that produced the image.  Tav just published <a href=\"http:\/\/tavmjong.free.fr\/blog\/?p=79\">an article<\/a> about how to improve this and I've talked long about <a href=\"http:\/\/codedread.com\/scour\">scour<\/a> in the past too.  Keep up, will ya?<\/p>\n<p>So SVG images can look better and have fewer bytes than their raster counterparts.  Booyahs all the way around.<\/p>\n<p>And they can go a lot more places than the &#60;object&#62; tag.  Feed readers, for one.<\/p>\n<p>Of course there are challenges:<\/p>\n<ul>\n<li>Not ubiquitous.  Yet.  We have to wait at least a year or more for that to be the case on the desktop but now there is definite momentum.  Android appears to be the only holdout on the mobile web side and it's being looked at.  Let's circle back in a year, mkay?<\/li>\n<li>Performance?  SVG images have more capabilities than a standard raster image (declarative animation, external styling) so I would suspect SVG images require more juice to display.  <a href=\"http:\/\/www.latenightpc.com\/blog\">Rob<\/a> and others talked about SVG performance at this year's <a href=\"http:\/\/svgopen.org\/\" title=\"Argh, I wish I could have made it!\">SVG Open<\/a>.  Frankly I suspect that things can be done on the browser side to optimize this case, so I look forward to learning more when you comment on my blog \ud83d\ude42<\/li>\n<li>Lot of crufty SVG out there.  This situation is improving too over time.<\/li>\n<li>Some SVGs don't have an intrinsic size (gee I hope I'm using this term right) and most things expect an image to have a size.  PNG files contain their width\/height in the bytes of the file header.  The width\/height values on &#60;svg&#62; elements default to 100%\/100%.  Some browsers have a problem with this (ok, WebKit mostly).  If you want to use SVG files as images, I suggest you start fixing WebKit bugs (or update your SVG files to have an explicit width\/height).  Can someone (Doug? Fantasai?) clarify what is supposed to happen if an SVG file has width\/height at 100% and the &#60;img&#62; tag does not specify a width\/height?<\/li>\n<li>Not a lot of software\/services accept SVG as an image type yet.  I'm looking straight at you to help me change this.<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"100\" height=\"100\" style=\"float:right\" src=\"http:\/\/codedread.com\/clipart\/villain.svgz\" alt=\"I want to believe. SVG as an image format.\"><\/img>So my take is that we're at about 15% of web users who can actually see SVG images (as compared to about 40% of web users that can see SVG documents).  Since I'm such a SVG <del>fascist<\/del> <ins>fan<\/ins> I've decided to change my WordPress clipart quicktag to use &#60;img&#62; instead of &#60;object&#62;.  This means that a lot of you Firefox users won't be able to see my blog clipart and for that I apologize up-front.  Come back and read it when you're using Firefox 4?<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Those wacky Mozilla guys just fixed a bug I&#8217;ve been waiting years for: They now support SVG in &#60;img&#62; tags (and in most image contexts, for example background-image). This will be available in Firefox 4 Beta 6 and beyond (or download a nightly).<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[25,46,11,28],"tags":[177,198,186],"class_list":["post-926","post","type-post","status-publish","format-standard","hentry","category-software","category-svg","category-technology","category-web","tag-images","tag-svg","tag-web"],"_links":{"self":[{"href":"https:\/\/www.codedread.com\/blog\/wp-json\/wp\/v2\/posts\/926","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.codedread.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.codedread.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.codedread.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.codedread.com\/blog\/wp-json\/wp\/v2\/comments?post=926"}],"version-history":[{"count":10,"href":"https:\/\/www.codedread.com\/blog\/wp-json\/wp\/v2\/posts\/926\/revisions"}],"predecessor-version":[{"id":935,"href":"https:\/\/www.codedread.com\/blog\/wp-json\/wp\/v2\/posts\/926\/revisions\/935"}],"wp:attachment":[{"href":"https:\/\/www.codedread.com\/blog\/wp-json\/wp\/v2\/media?parent=926"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.codedread.com\/blog\/wp-json\/wp\/v2\/categories?post=926"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.codedread.com\/blog\/wp-json\/wp\/v2\/tags?post=926"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}