Firkin’s Circular Ornament 25

by AdamStanislav - uploaded on September 21, 2016, 8:19 pm

Just out of curiosity, I wanted to see how much I could cut out of the original SVG without changing the look of the graphic. In about two minutes, I got rid of 89,673 bytes by shrinking the size from 250,033 bytes to 160,360 bytes. I could have cut out another 4 bytes by placing everything on one line, but that would make it harder to read.

Log in to add this clipart to a collection.

Tags
360 circular ornament
Safe for Work?
Yes
Download SVG

Comments

Nice slimming. How did you achieve it?

Well, I first noticed the file contained multiple paths, each stating its fill was #000000 and its opacity 1.0. Those are the defaults, so they need not be declared, certainly not on every single line.

Secondly, I noticed it used absolute values, i.e., telling the value of each point of each path. It is much better to use relative values, i.e., you start with the absolute position in the first move of each path, then continue with relative positions (i.e., the difference from the previous position). The relative values tend to be smaller. For example, to draw a line from 550, 600 to 555, 605, the absolute command would be M550 600L555 605, while the relative would be M550 600l5 5 - which is four bytes smaller. That may not seem like much but when you have thousands paths and subpaths, it adds up quickly. (NB: Capital letters, such as the M and L) mean absolute values follow, lower case (such as the l) mean relative values follow.)

I also noticed it had unnecessary spaces, so the above example of M550 600L555 605 would be M 550 600 L 555 605, another three bytes extra in just such a brief example.

To convert from all of that, I simply opened the file in Inkscape, pressed Ctrl-A to select everything, then chose Path/Combine (though I could have just pressed Ctrl-K for that), then chose Save As from the menu and instead of accepting the default (which is terribly inefficient) I scrolled down to Optimized SVG, which offers a bunch of options to get a much, much smaller file. I saved that, then opened the result in a text editor and still cut out the unnecessary junk Inkscape puts in the line. I do that last part all the time, so it only takes me a few seconds. I also deleted the one and only tab before the path statement, but that was just a final touch.

Oh, and I changed the line endings from DOS/Windows (carriage return followed by a line feed) to Unix (just a line feed, no carriage return).

Very simple! BTW, I really wish our contributors who use Inkscape would save their clipart in that Optimized SVG format, even if they did not edit it any further. By default, Inkscape uses its own format which, unfortunately, also uses the .svg extension because it is a superset of actual SVG but it adds all kinds of information only Inkscape understands. Of course, they can save it in the default Inkscape format for themselves, but I really wish they also created a copy with the Optimized SVG for uploading here.

This will change the way I do things. I have no interest in wading through the code with a text editor, but it seems there's much I can do to store my stuff more efficiently with just a few mouse clicks using Inkscape. Thanks very much for the tip :)

After a little experimentation, it seems there's even more benefit to be had from optimizing some of the colour images I processed from old books and vectorized using Vector Magic. By optimizing, particularly with a notch less significant figures (which is generally not noticeable), it looks like my future postings will be half the size. I may go back and address some of my worst extravagances of the past also. So, once again thanks for the tip!

And, again as always, you could reduce file by 18 times if you had used cloning.

Inkscape svg saves useful information as well for editing.
Guides, objects outside the viewbox with instructions, layers switched off, and so on.
On an optimised svg you can't even change the background colour.

Given this was originally painted by hand and, while the various sections of the image are very similar, they have subtle differences, no, you could not use cloning without changing the look of the graphic.

Original was drawn with paint.net's filtering. Which is equivalent of cloning. If you don't mind the mentioned differences, it could be cut down by 36 times.

Sloppy original material doesn't mean all details were added with reason.

Reproducing imperfections. Ink fades. Paper wraps. Threshold changes. Original illustration too small.
While such jaggedness can be added to a clean design easily.

Already uploaded #261529, #261516, #227853, #247175 for example on a clean "kaleidoscope".

What do some “examples” have to do with this? We’re talking about taking a specific existing SVG graphic and cutting it down in size under 2 minutes. If you can cut it down 36 times in under two minutes, by all means do so. If not, why are you strawmanning this discussion?

Because having such a repeating pattern is mostly pointless. Every single clipart uploaded here can be used to generate dozens of repeating images. The process could be scripted, ocal could have a button to make a "kaleidoscope". Examples show that clearly. Same with most of the patterns.
Can you post an example where you would use the "kaleidoscopic" example instead of the original decoration it was based upon?
On what end do you think 2 minutes of fiddling with an existing clipart adds in that much of the quality?
It may be challenging to compress a file by keyboard gymnastics some cases but at the end it doesn't really add up to the drawing.

In response to Lazur URH - you might not be getting much agreement on your point that 'having such repeating patterns is pointless' A great many thousands of people have been interested enough to at least go in for a closer look at the things I posted that are made up of repeating units. I'm sure others active on this site can say the same thing. It matters not that with some knowledge and effort users could have generated it themselves from a suitable unit. They didn't have to. And I'm sure many users of the material on this site are content just to grab things for their powerpoint or something like that and don't want extra effort. If you want a vase, you can spend time learning glass blowing and then make your own - or you can just get one from the shop. Some of these type of images are for the people who want to get one from the shop.

I also think there's room for relatively 'rough' images for want of a better word. My experience is that not everyone is turned on by the mathematical precision of some computer generated stuff. I've sensed from a lot of your comments in the past that you're more in the other camp. And that's fine too. It would be boring if we were all the same :)

“but at the end it doesn't really add up to the drawing.”

LOL, the whole point was not to change the drawing itself. The main value of shrinking the code is in saving bandwidth. If some clip art is downloaded from here and posted on a popular and high traffic web site, the unnecessarily bloated size of the SVG adds to the Internet congestion. And not just for the visitors of that web site. We all share in the same bandwidth regardless of what web sites we visit, or even if we don’t visit any web sites, just use the Internet for other things. So, if we can shave off a substantial chunk of the size by just a few keystrokes, yes, that is a very valuable skill.

Sorry, I was going to say more, but I have to go to a funeral right now.

Log in to comment.