Scaling an SSVG image in a webviewer

Hello all,
So I have an SVG image that downloads from the web and displays in a web viewer.
(Can't use container fields for SVG as far as I am able to determine).

It displays all right but in a huge size. So how do I scale it to a size lets say 300 x 300 pixels. Basically this is an image of a country's flag and it downloads full size.
The URL is : https://restcountries.eu/data/can.svg

So can someone pls help with code that will scale the full size image down to required size.
thanks
Kevin

1 Like

You could embed it in a bit of HTML to define the size of the area you show it inside.

2 Likes

Not sure if this is what you're asking, but you could also write a little code to do image scaling. Lots of examples of that. You could use the @MonkeybreadSoftware's plug-in to run its "Shell" command to run that code.

Well, I think Kevin wanted to show the SVG in a web view scaled down.
Maybe just put it in a container and tell the container to scale to fit?

1 Like

Thanks Christian and OliverBarrett:
I tried this - does not work.

"data/text:html,
<html>
<body>

<img width = 300 src = Countries::flagURL>
</img>

</body>
</html>"

Where Countries::flagURL is a field containing the URL for the flag and changes with each record.

Any help appreciated.
thanks
Kevin

1 Like

You must be much more precision. extra spaces, missing quotes and a field name won't fly.
The HTML must contain the field value, not the field name.
Please ty again.

4 Likes

Got it. Thanks to encouragement from Christian :smile:
For convenience of others just posting the correct code which worked for me.

Substitute (
"data:text/html,
<html>
<body>
<img width = 300   src=country></img>
</body>
</html>"; 

"country" ; Countries::flagURL)

Now the flag image perfectly resizes and fits in the web viewer.
Kevin

3 Likes

Please replace with

<img width=300 src="country">

no end tag for img and no spaces around = and URL in quotes may help.

1 Like