Using svg image in script

Hi guys!
I want to use an SVG image that I get from my API.
I can’t use request.loadImage()…
Any chance anyone can advise how do I do that?

I saw that @rob used team logos in his widget and that’s exactly what I want to do!
I use this API - https://www.football-data.org/

and I get the team logos from: https://crests.football-data.org/{teamId}.svg

Thanks!

I might have cheated…

Apparently I have an “img” folder within Scriptable with transparent PNG’s with filename {teamId}.png

(Can’t remember whether I converted the SVG’s using a tool or searched for different PNG’s)

But support for SVG would be much nicer!

1 Like

thought about it, but there are too many teams :slight_smile:
Thank you for your response

I did it for a single competition only.

All other matches won’t show team logos…

@simonbs SVG support would be nice!

2 Likes

Xcode 12 and iOS 14 added support for SVGs but I believe this was only on build time, so the SVGs are actually converted to PNGs which are then loaded on runtime.

As far as I know, iOS doesn’t support loading SVGs at runtime, so if I was to ads support for this in Scriptable, I would have to build it myself or rely on a third party dependency. Neither of those are super appealing.

That said, I can certainly see the benefit of adding support for SVGs. If many users have the need for it, I’ll consider it for a future update :blush:

4 Likes

Thanks mate! Hope it’ll happen!

In the mean time someone on Twitter suggested TheSportsDB as another data source.

They provide team badges as PNG images!