Jump to content
You must now use your email address to sign in [click for more info] ×

Unnecessary groups in SVG


ashf

Recommended Posts

Every single one of objects are often wrapped by group individually which is unnecessary when export a SVG.
Not sure what's exact condition to recreate it. but sometimes it's wrapped, sometimes not.
I attached an afdesign file that grouping problem happens as an example.
It contain only simple shape(closed curve) and line(open curve) that's styled with only stroke and fill.
There's no factor to be rasterized or divided.

ad-svg-group.png

svg-test.afdesign

Link to comment
Share on other sites

I just downloaded your afdesign-file to open it in Designer and exported it to svg. But the generated svg doesn't contain any <g> groups.  I tried both with raster output enabled as well as with raster output disabled in the exporter, but both have the same result: no groups.

Also when importing the created SVG in Designer Designer doesn't show any groups.

So not sure what issue you are facing, but I can't reproduce it here with the given file (Designer 1.8.3)

Link to comment
Share on other sites

Easily reproduced @ashf @wigglepixel

image.png.02a5f4b8af1ee5499a55c0b552cd6825.png

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="100%" height="100%" viewBox="0 0 2481 3508" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:1.5;">
    <g transform="matrix(1,0,0,1,-69,235)">
        <path d="M2138,1678C2193.08,1926.57 2516.83,2264.57 1951,2465C1385.17,2665.43 1149.55,2941.75 929,2555C708.452,2168.25 563.716,1995.05 460,1947" style="fill:none;stroke:black;stroke-width:32.83px;"/>
    </g>
    <g transform="matrix(1,0,0,1,-600.481,-221)">
        <path d="M1495.5,836L1609.95,1165.5L1830.51,1063.68L1795.14,1291.36L2165.52,1291.36L1865.88,1495L2037.56,1659.75L1795.14,1698.64L1909.6,2028.14L1609.95,1824.5L1495.5,2028.14L1381.05,1824.5L1081.4,2028.14L1195.86,1698.64L953.443,1659.75L1125.12,1495L825.481,1291.36L1195.86,1291.36L1160.49,1063.68L1381.05,1165.5L1495.5,836Z" style="fill:rgb(255,0,0);"/>
    </g>
</svg>

 

  • "The user interface is supposed to work for me - I am not supposed to work for the user interface."
  • Computer-, operating system- and software agnostic; I am a result oriented professional. Look for a fanboy somewhere else.
  • “When a wise man points at the moon the imbecile examines the finger.” ― Confucius
  • Not an Affinity user og forum user anymore. The software continued to disappoint and not deliver.
Link to comment
Share on other sites

34 minutes ago, Jowday said:

Easily reproduced @ashf @wigglepixel

It was not that 'Easily reproduced' for me, as I use four of my own svg export presets depending of the needed output and I never had this issue before and tested it on all four of those exports.

So my presets work fine, but the build in SVG for export preset doesn't. So I just compared the settings in my presets with the preset having the issue (SVG Export, but probably the other build in presets as well?) and found the difference: In all my SVG export presets I have 'flatten transforms' enabled preventing the created groups. But with the default SVG Export preset this isn not checked.

Without 'flatten transforms' enabled Designer wraps the <path>s in extra groups just to apply transforms. But instead it should apply the transforms to the <path>s and not create extra groups as this disturbs the hierarchy inside the svg. I agree creating extra groups by the exporter is wrong and should never happen. There are other posts on this forum about redundant groups in svg too.

image.png.0a71ceeaf37996baeaefd500afbd0f0e.png

Link to comment
Share on other sites

  • 2 weeks later...
  • Staff

Hi ashf,

I've just tried this in 1.7.3 and getting the same behaviour as 1.8.3. However I believe this is intentional - the problem is that whilst some people don't want superfluous groups, others do want them because certain pieces of software rely on the structure to be in place - therefore we keep them in, but the option to remove them using Flatten Transforms is there.

Link to comment
Share on other sites

7 hours ago, Sean P said:

Hi ashf,

I've just tried this in 1.7.3 and getting the same behaviour as 1.8.3. However I believe this is intentional - the problem is that whilst some people don't want superfluous groups, others do want them because certain pieces of software rely on the structure to be in place - therefore we keep them in, but the option to remove them using Flatten Transforms is there.

I see.
I guess Flatten Transforms should be enabled by default.
I reported this because some people complaining on social media about this when they brought a svg to another vector graphics app.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.