It’s just data

SVG Tidy

Normally, I hand craft my images using vim.  I also try to limit myself to 1K bytes.  I occasionally find it convenient to start from an existing image.  Sometimes that works out.  Sometimes it does not.

This image nearly did not work out.  In retrospect, I would have spent less time writing it from scratch, but some good did come of the effort.  But first, the problem.  Or rather problems.

The first problem can be illustrated by this excerpt:

<svg viewBox="0 0 128 102">
  <g>
    <g transform="matrix(1.8,0,0,1.8,-556.831,-272.2498)">
      <g transform="translate(-44.25663,-9.440477)">
        <g transform="translate(-225.2675,-211.7949)">
          <path transform="matrix(0.738729,0,0,0.738729,168.6073,57.12999)"
             style="stroke:none;stroke-width:9.14700031"/>
        </g>
      </g>
    </g>
  </g>
</svg>

What this defines is the width of a stroke (typically the border of a shape) to nine digits of precision.  And then specifies two scalings and four translations (movements about on the page) to be applied to the path.  All for a stroke that is none i.e. not to be shown at all.  I realize that the interior is filled, but why specify the stroke to so many digits of precision and have so many transformations defined?

But that’s just number crunching.  The second problem is that the icon is too busy and too detailed.  It doesn’t work well as an icon.  In fact, if shown full screen and centered on a 1080p widescreen display, there are a number of curves so delicate that they would not deviate by so much as one pixel from a straight line.  There also are a number of lines that would show up as zero pixels in length.  In fact, there even is one curve that also would not occupy any pixels at all.

I’ve not quite gotten this down to my self-imposed limit of one K bytes, but I am getting closer.  In the meanwhile, this effort has motivated me to collect up a number of my ad-hoc scripts that do various tedious number crunching exercises and package them up as a script.  I even have a spec written using bacon as bacon is known to work on Ruby 1.9.

While you should be able to use your choice of Rubies, you will need a recent version of REXML.  Preferably one from SVN.


"Normally, I hand craft my images using vim"

“Normally, I hand craft my images using vim” - Sam Ruby...

Excerpt from Application Error at

PrinceXML Is Extremely Impressive

I didn’t know it was possible to build such nice closed-source programs....

Excerpt from Ryan Tomayko at

You just converted the entire dev team at my office into SVG fanboys :-) ... thanks!

Posted by Charlie at

This is really cool but the only thing that I notice is that this is not working using the Internet Explorer but worked prefectly in my FireFox.

Posted by ChainsawCR at

"Normally, I hand craft my images using vim."

Normally, I hand craft my images using vim. – Sam Ruby is the ubergeek...

Excerpt from WHAT HAPPEN at

Sam Ruby: SVG Tidy

[link]...

Excerpt from del.icio.us/lezek at

PrinceXML Is Extremely Impressive

I didn’t know it was possible to build such nice closed-source programs....

Excerpt from Ryan Tomayko's Writings at

Språkrådets m.fl. sitt forslag til et norsk ord for «feed»

Selv om jeg har lagt ut svaret tidligere så kan det kanskje være greit å lage en egen post....

Excerpt from Logg for Aslak Raanes at

SVGのファイルサイズを小さくするツール

Adobe Illustrator や Inkscape や sodipodi などのソフトで作った SVG ファイルは、不要な要素などが含まれていたりして、けっこうサイズが大きくなったりする。 SVG というのは単なるテキストファイルなので、普通にエディタで開いて人力でチマチマ頑張ればサイズを小さく...

Excerpt from by edvakf in hatena at

Sam Ruby: SVG Tidy

Sam Ruby: SVG Tidy...

Excerpt from NI-Lab.の電子栞 / svg (113) at

“Normally, I hand craft my images using vim.”

The above is a quote from Sam Ruby’s blog.  This deliciously innocent pedantry made me choke on my coffee in laughter....

Excerpt from deviled eegg at

Add your comment