I have an image in svg format of height and width 45 i want to upscale it to 75 is it possible to do without losing quality in pygame.
The image before resizing:
The image after resizing:
The code I used to resize:
pygame.transform.scale(pygame.image.load('bP.svg'),(75,75))
CodePudding user response:
this should help with upscaling as it uses a bilinear filter:
pygame.transform.smoothscale(pygame.image.load('bP.svg'),(75,75))
CodePudding user response:
The format of the Scalable Vector Graphics is a text format. You can edit the SVG file and add a global scale (see SVG/Transformationen). e.g.:
<svg
transform="scale(2)"
...
>
Since 2.0.2, SDL Image supports SVG files (see SDL_image 2.0). Therefore with pygame version 2.0.1, pygame.image.load()
supports SVG files.
The scaling must be done when the Scalable Vector Graphic is rendered in a pygame.Surface
. It would be nice to have a scale or size argument in pygame.image.load()
. However, something like this is not documented (yet).