Inkscape.org
Beyond the Basics Can Inkscape 'flatten' transforms?
  1. #1
    Pacer Pacer @pacer🏁
    🖈*

    I use Inkscape for many things including print, web graphics and SVGs for web animation. One thing that causes issues (and a lot of additional work/time) is cleaning up the code (to make the file size smaller and the code easier to read).

    While I know that there are a number of workarounds (such as grouping objects before moving them, then ungrouping them, and the apply transforms extension). I have not found an efficient and reliable method that works in all circumstances.

    Transformations which are really hard to clean up are:

    • Cloned objects (without 'uncloning' first)
    • Clipped objects
    • Colour gradients

    While simple graphics can be easy to fix, more complex graphics are very tricky indeed and my efforts to clean them up inside Inkscape (grouping, moving, cutting and pasting in place in the correct position/order, then ungrouping) often cause Inkscape to crash.

    While I love using Inkscape. I really do wish I had a better way to deal with these things.

    Any advice on how to resolve these issues would be well-received.

  2. #2
    just-a-hriday just-a-hriday @just-a-hriday
    *

    I believe Inkscape 1.3's new Path Flatten does the job.

  3. #3
    inklinea inklinea @inklinea⛰️

    Pacer, can you confirm that flatten works for a single element ? 

    I've tested it on single elements. I've found it does work, however on occasion you might no longer be able to break into the original subpaths. 

    For example if you have done Path>Combine then transformed, then flatten. It should look the same however sometimes you cannot Path>Break Apart to get the same (transformed) shapes to split out. 

    Flatten won't work for a multiple selection or group as it tries to flatten to visible paths. 

    If the 1st scenario works, I might be able to loop it on canvas. 

  4. #4
    inklinea inklinea @inklinea⛰️
    *

    Okay 

    Forget flatten. 

    I have bodged this together: 

    https://gitlab.com/inklinea/dbus-flatten

    It seems to work most of the time :)

    I should add that it does convert shapes ( rect / circle / ellipse etc ) to path if they are flattened.

  5. #5
    Pacer Pacer @pacer🏁

    @inklinea sounds good. Will your tool deal with clones or gradients?

  6. #6
    inklinea inklinea @inklinea⛰️

    It won't work with clones, as it converts to path first :(

    However if you have a sequence that you know works with clones, It could be replicated ( maybe ) 

  7. #7
    inklinea inklinea @inklinea⛰️
    *

    It won't work with clones, as it converts to path first :(

    However if you have a sequence that you know works with clones, It could be replicated ( maybe ) 

    I think it would only work for translate to be converted to x, y as cannot covert rotate / scale without changing the path - and then it would not be a clone :)

  8. #8
    Pacer Pacer @pacer🏁

    @inklinea Understood. Yes, dealing with translate (on clones) would be useful.

    Off-topic question: Is it possible to replicate a process that involves boolean operations combined with lattice deformation?

  9. #9
    inklinea inklinea @inklinea⛰️
    *

    Would need to see an example sequence  (workflow ) that you use to see if I can replicate it :)

  10. #10
    Pacer Pacer @pacer🏁

    @inklinea OK. As it is a bit off topic. I'll DM you in RocketChat. Also thank you for looking into the transforms issues. :)

  11. #11
    inklinea inklinea @inklinea⛰️

    I've replaced the above with this:

    https://gitlab.com/inklinea/ink_flatten

  12. #12
    Sean Sean @SeanRickard

    Hi, I just want to put a post in here because I may need to reference this in the near future.  I am just about to work on an animation where the background is 1.3mb already, which may not sound a lot, but by the time i get into 200 or 300 or 400  frames, the file size may rise dramatically.

  13. #13
    inklinea inklinea @inklinea⛰️

    It might be worth posting the problems you are having.

    A step by step process of what you do, or want to do. 

    With a sample file to show.

  14. #14
    Sean Sean @SeanRickard

    Hi, no probs as yet, I just wanted to mark this thread for later reference. I haven't fully explored 1.3 yet and I was unaware of the path->flatten. I try to keep my projects small because my workhorse is an old Win7 2.2ghz laptop, although if need be, I do have a desktop I can use but that is not so much in my creative space . I am in the process of doing a series of short advertising gif animations; the first was 45 secs. I am now on the second one and the static background of scene 2 is 1.2 MB, so, assuming I end up with something in the order of 300-400 frames, that might be in the order of a 300+ MB file assuming my predictive math is correct. I am going to start drawing the animated part either tomorrow or the day after, and that is when the compacting might be required, cheers Sean.     

Inkscape Inkscape.org Inkscape Forum Beyond the Basics Can Inkscape 'flatten' transforms?