Mobile app version of vmapp.org
Login or Join
Correia448

: Programmatically created a gradient effect through division of space into fine mesh, and then colouring each box. SVG output huge! How to simplify? I am fancying up the output of one frame of

@Correia448

Posted in: #Inkscape #Optimization #Svg

I am fancying up the output of one frame of my simulation. In particular, I decided to draw out a relevant background chemical. I used Cairo to execute about the only approach I am familiar with for such a problem: divide up the background into a fine mesh, and calculate the alpha (representing the strength of the chemical in a particular box) at each box separately. Here's what the background alone looks like when zoomed out:



And when zoomed in:



There are around 270k paths, each with 4 nodes. Total file size of the background is around 70 MB.

Simplifying paths doesn't do anything, because the paths are already super simple (just a box). I am hesitant to rasterize (which is about the only option I know of right now), so I wonder: are any other options?

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Correia448

2 Comments

Sorted by latest first Latest Oldest Best

 

@Gail6891361

This is not something that can be solved. SVG is just the wrong format for this. Use bitmaps or something else. Although you better not use paths just use rectangle elements, but still SVG is super verbose.

You should use a OpenGL shader instead

10% popularity Vote Up Vote Down


 

@Moriarity648

Rather than boxes, why don't you create a grid using a couple of paths and the Interpolate extension. The shapes don't have to be boxes ether, just a regular single path.

So the finished SVG will still have many paths, but no where near as many if each one is a box.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme