Set svg renderer aspect ratio mode to KeepAspectRatio
This commit is contained in:
parent
1e8052d905
commit
284126e855
|
@ -31,8 +31,12 @@ def GenerateThumbnailBytesFromSVGPath(path: str, target_resolution: tuple[int, i
|
||||||
( target_width, target_height ) = target_resolution
|
( target_width, target_height ) = target_resolution
|
||||||
|
|
||||||
renderer = LoadSVGRenderer(path)
|
renderer = LoadSVGRenderer(path)
|
||||||
|
|
||||||
|
# Seems to help for some weird floating point dimension SVGs
|
||||||
|
renderer.setAspectRatioMode(QC.Qt.AspectRatioMode.KeepAspectRatio)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
||||||
qt_image = QG.QImage( target_width, target_height, QG.QImage.Format_RGBA8888 )
|
qt_image = QG.QImage( target_width, target_height, QG.QImage.Format_RGBA8888 )
|
||||||
|
|
||||||
qt_image.fill( QC.Qt.transparent )
|
qt_image.fill( QC.Qt.transparent )
|
||||||
|
|
Loading…
Reference in New Issue