Skip to content

Instantly share code, notes, and snippets.

zgoda /
Last active Dec 27, 2020
Load svg into Pygame image using pynanosvg (
from svg import Parser, Rasterizer
import pygame
import sys
def load_svg(filename, mode='RGBA', scale=None, size=None, clip_from=None, fit_to=None):
"""Returns Pygame Image object from rasterized SVG
If scale (float) is provided and is not None, image will be scaled.