Set svg renderer aspect ratio mode to KeepAspectRatio

This commit is contained in:
Paul Friederichsen 2023-07-08 14:41:37 -05:00
parent 1e8052d905
commit 284126e855
1 changed files with 4 additions and 0 deletions

View File

@ -31,8 +31,12 @@ def GenerateThumbnailBytesFromSVGPath(path: str, target_resolution: tuple[int, i
( target_width, target_height ) = target_resolution
renderer = LoadSVGRenderer(path)
# Seems to help for some weird floating point dimension SVGs
renderer.setAspectRatioMode(QC.Qt.AspectRatioMode.KeepAspectRatio)
try:
qt_image = QG.QImage( target_width, target_height, QG.QImage.Format_RGBA8888 )
qt_image.fill( QC.Qt.transparent )