SVG images are broken in Android client

What’s The Bug?

SVG images display is broken in Android client

How To Reproduce It

  1. Use any SVG image as page icon or image within page. Better check with attached image back-pain-woman-svgrepo-com.svg as it is definitely broken
  2. Open the page on Android
  3. See image display is broken

Image or Video

SVG example below, grab it to reproduce:


The Expected Behavior

All images types that are allowed to be used should be displayed properly on all clients.

Additional Context

I know SVG might be tricky and renderers might support different subsets of full SVG spec. But example image is properly rendered with Qt renderer and other android apps, thus even SVG Tiny support should be enough to properly render it. But check screenshot how it is broken.

Device

Pixel 6a Google

OS

Android

Anytype Version

0.37.15

Network Mode

irrelevant

Technical Information

Device: Pixel 6a Google
Android version: 35
App version: 0.37.15
Build number: 3715
Library version: 0.40.18
Account ID: A6hQj1AtUWnhqFDJvFwpmJHNYJyhRznqLGHXsgdnr7bzHpYe
Device ID: 12D3KooWGzVP5PGMyfXGuz6J67UnNimoxxfbJQf1RXnidrN3eL9E
Analytics ID: 8c1cee72-f885-45ec-b70d-2b62ecd608b7
Ethereum key ID: 0x26cCbF3072682A62B63C1876DB50C4a72633F03D

WHAT DO YOU RECOMMEND?

Here is my story I uploaded a SVG file via drag and drop from desktop. But on mobile the SVG is not properly rendered.

HOW COULD IT BE DONE?

iOS or mobile should be able to show SVG properly

REAL WORLD USE CASES

*SVG is a powerful format m, allowing interactions with it is wry important. Embedding markdown or other text in SVG and then Index it from Anytype should be possible

RECOMMENDED ALTERNATIVES

*ᅟjust implement this, you don’t want to be and app that behaves like IE6 while the OS supports the file format

ADDITIONAL Context

Tools like sozi allow for SVG animations. Since you are anyway building a HTML/JS REPL make sure everything is useable and customisable.

Thank you for your work

Did you observe garbled SVG image on iOS or Android client?

Your report seems to duplicate mine SVG images are broken in Android client

It seems better to vote for one issue and provide additional details in one place then create new topics.

This report has been added to our issue tracker and received by the Development Team.

Starting from the next release, 0.42.*, support for SVG and GIF images has been added at the level of the library responsible for rendering. I can’t guarantee that absolutely all images will display correctly, because there are compatibility issues on the Android platform itself.

This issue has been fixed by the Development Team and will be implemented in an upcoming release.

coil3 can apparently decode AVIF and HEIC formats since they are supported natively on newer Androids, and potentially JXL using a custom decoder. There might be some community plugins for that. What are the chances for getting some of these included, as well?

Rendering of the test image I provided in this bug report has not improved in 0.42.13

I can confirm that 42.15 still has an issue with SVG rendering

Also confirming the issue in Android 0.43.5.

OK, after experimenting I’ve found 2 issues as to why not all svgs render fine.

1. Path before Def

I made a minimal test with exporting a square with a linear gradient from Figma. That one failed because the path was before the lineargradient definition. I’ve attached basic_wrong (directly exported from Figma) and basic_fixed (where I fixed the order and it renders fine in Anytype)

2. “Gradient templates”

This explains this issue well: support xlink:href attributes in gradient elements · Issue #191 · googlefonts/picosvg · GitHub
and here is Google’s internal python fix: add method to resolve gradient templates by anthrotype · Pull Request #199 · googlefonts/picosvg · GitHub

Basically the issue is that many tools (including Adobe Illustrator) are generating these “Gradient templates” by having xlink:href on one gradient point to a base gradient. This doesn’t seem to be supported in Anytype or many Android apps. I tried to embed the “gradient template” into each gradient using them, and it renders fine again. Attached is the more complicated svg in a wrong and fixed version: 07-note_wrong 07-note_fixed.