Skip to main content
Participant
May 19, 2022
Question

Saving SVGs with clip paths adds extra groups

  • May 19, 2022
  • 1 reply
  • 3192 views

When an AI file containing a shape (test.ai) with an image fill is exported as SVG (test.svg), a SVG group is created containing the shape's path with clipped sub-groups, defined using <defs>, containing the image. All well and good, apart from the fact that the shape's path is duplicated -- once in a <defs> element for clipping, once as the actual <path> -- and I suspect there's scope for optimisation.

If the saved SVG (test.svg) is resaved (as test1.svg) the groups above are wrapped in extraneous <g> elements -- one before each nested <defs> element, resulting in three additional nested groups. If test1.svg is saved again (as test2.svg) another three group elements are added.

Ongoing saving and opening a SVG eventually results in AI warning "There are too many nested groups than allowed in Illustrator. The file may not open correctly." and the shape's image fill is lost.

1 reply

Anshul_Saini
Community Manager
Community Manager
May 23, 2022

Hi @David24526970hc9e,

 

We are sorry for the trouble. This was a known issue that came with Ai 26.2.1 while exporting SVG containing images. But I am glad to inform you that we have tried to address the issue in v26.3.1, released recently. Let us know if that works. 

 

Regards,

Anshul Saini

Participant
May 23, 2022
Hi Anshul,

Thanks for responding. Unfortunately the issue exists with AI 26.3.1,
this being the version I used in my testing. In fact I suspect the issue
predates AI 26.2.1 as we noticed image fills sometimes disappearing from
SVGs late last year -- this has now become more problematic for us,
hence my investigation as to why.


Best regards,
Dave
Anshul_Saini
Community Manager
Community Manager
May 25, 2022

Thanks for sharing the details. You are correct. This issue started happening after v26.1 was released. The current workaround is to downgrade the app to v26.0.3 or older. We are targeting a July release to fix the issue, but it is possible to get delayed.

 

I hope this info helps!

 

Regards,

Anshul Saini