Bug 29677 - [Enhancement] Add support for loading and displaying SVG images in Xamarin.Forms
Summary: [Enhancement] Add support for loading and displaying SVG images in Xamarin.Forms
Status: RESOLVED ANSWERED
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.4.4
Hardware: All All
: Normal enhancement
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-05-02 16:04 UTC by Emanuele Sabetta
Modified: 2018-02-12 21:18 UTC (History)
21 users (show)

Tags: SVG AC
Is this bug a regression?: ---
Last known good build:


Attachments
Sample SVG button elements (17.39 KB, application/zip)
2015-05-02 16:04 UTC, Emanuele Sabetta
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED ANSWERED

Description Emanuele Sabetta 2015-05-02 16:04:44 UTC
Created attachment 11032 [details]
Sample SVG button elements

The current trend is switching to vector graphics, but Xamarin.Form is lacking support for it. Currently PNG or bitmaps assets are being dropped from cross platform developement, and for many good reasons. We need SVG support in Xamarin.Forms, and we need it asap.

The following are the main advantages to use vector SVG assets instead of PNG or bitmaps assets in app:

1 - SPACE : Bitmaps are an incredible waste of space and bandwidth. My app dropped from 130 Mb to only 20 Mb after I have redrawn all graphic assets in SVG.
2 - SPEED : Drawing vector graphics is usually faster and leaner than rendering bitmaps, thanks to the GPUs accelerations now very common on all mobile devices
3 - QUALITY : No matter how much you scale, zoom or rotate an svg asset to fit your UI, it will always preserve perfect quality. Bitmaps instead are quickly degraded if any scaling or manipulation is applied.
4 - SCALABILITY : SVG assets doesn't need to be tailored to the dozen of different devices and screens resolutions. They will automatically render at the best possible quality available at the current display dpi. And they will still be even if the user zoom.
5 - REUSABILITY : SVG assets can be easily reused in many version of the application. You don't need to create different graphics assets for the Mobile, Desktop or Web version of an app, because the vector assets can be easily reused in any platform with no changes.
6 - ANIMATIONS : SVG Assets that need animations for visual feedback (buttons pressed effects, switch sliding, menu expansion when touched, etc.) can be animated indipendently from a specific platform animation API, and the animation is consistent on all platform, while taking advantage of the speed of the system to get the best frame rates, thank to not being limited by a fixed number of precalculated bitmap frames.
7 - OPEN STANDARD : SVG is an open standard for vector graphics, and it is handled natively by graphics applications used by professional artists all over the world, like Inkscape, Adobe Illustrator, Sketch, Corel Draw, etc. on all different platforms. You are not locked in some proprietary format for your user interface elements, allowing a seamless interoperability between staff members and between different projects sharing some assets.

Currently the only way to use SVG in a Xamarin.Forms app is to buy an external component in the Xamarin Store (priced $99) that is advertised as having complete SVG 1.1 support.
You can read about it here:
https://forums.xamarin.com/discussion/29002/smaller-package-less-work-svg
Unfortunately I tested the free trial version with many of my assets (buttons, controls, etc.) saved from Inkscape in plain svg format and they do not work. The component just crash.

You can download the .svg test file of my buttons from here: http://goo.gl/m7TbmM
I've also attached a zip file with the separated button components.

There is also this open source component in the work, supposed to support for SVG vector assets: 
https://github.com/praeclarum/NGraphics
Unfortunately it seems an abandoned (or very slow developed) project, still very incomplete. 

There is a discussion open about the lack of SVG support in the Xamarin forum:
http://forums.xamarin.com/discussion/comment/109775

SVG is becoming more and more used. Illustrator, Inkscape and Sketch are replacing Photoshop in the production pipeline. Even PaintCode in its latest version (2.3) added the option to output in SVG format instead that in C# code format. 

The lack of native SVG support is a show stopper for people who are considering writing cross platforms applications in Xamarin.Forms.

Please add support for it. Thanks.
Comment 1 Parmendra Kumar 2015-05-04 08:59:19 UTC
As per my understanding this issue seems to be enhancement so I am going to conform this issue.
Comment 2 Emanuele Sabetta 2015-09-08 11:27:56 UTC
Any update on this? My company would be forced to switch to another development platform if this is not implemented soon.
Comment 3 Eder 2016-04-16 02:52:57 UTC
Any news about this ?
Comment 4 adrianknight89 2016-04-28 22:24:39 UTC
+1. This is something that should be part of Forms asap. Most people are tired of using different resolutions of images. I saw two 3rd-party nuget packages, but they both had issues and were unusable.
Comment 5 Daniel 2016-05-25 15:35:05 UTC
Please bring this feature of the Android support library (v. 23.2 I think) to Xamarin.Android! This will make our lives much more easier, and also reduce the size of the apk (which is a big plus considering the additional size due to Xamarin packages.)
Comment 6 FieldstrikeMobile 2016-05-25 16:29:24 UTC
@adrianKnight I am currently investigating those two nuget packages. What did you find was the problem with them?
Comment 7 Yuri 2016-12-22 23:08:00 UTC
It is already $295 not $99 anymore :-)
Comment 8 Dimitar Dobrev 2018-01-03 16:09:05 UTC
When is this going to be implemented? Android has supported vector graphics for 3 years now.
Comment 9 Paul Brenner 2018-02-12 19:50:57 UTC
See https://github.com/xamarin/Xamarin.Forms/issues/1863
Comment 10 Samantha Houts [MSFT] 2018-02-12 21:18:28 UTC
Please subscribe to https://github.com/xamarin/Xamarin.Forms/issues/1863 for future updates. Thanks