1

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:

enter image description here

And when zoomed in:

enter image description here

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?

  • 1
    I might be missing something, but I don't understand why you need it to be an SVG file. To me it looks like an ordinary raster image and I don't see any scalable vector paths. What are you trying to achieve using SVG instead of just PNG/TIF? – Wolff Feb 18 '18 at 10:05
3

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

1

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.

enter image description here

  • Well, I am not creating the grid in Inkscape. The grid is output by a Python program I have written. Can Inkscape simplify the paths using Interpolate? – user89 Feb 17 '18 at 17:46
  • I looked into interpolate a bit more (inkscape.org/en/doc/tutorials/interpolate/…), and I don't think it's right for me. I am not determining the colour for each box based on interpolation (that wouldn't really work for around 25% of the boxes). – user89 Feb 17 '18 at 17:49
  • 1
    @user89 - your question is tagged "Inkscape", and I said "rather than boxes". This solution has no boxes at all. The paths in the grid would be very simple - just a start node and an end node for each one. You can see me highlighting the paths in the animation. – Billy Kerr Feb 17 '18 at 19:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.