"""Rasterize the application's own vector icon with the bundled Qt runtime.""" import os from pathlib import Path os.environ['QT_QPA_PLATFORM'] = 'offscreen' from PySide6 import QtCore, QtGui, QtSvg app = QtGui.QGuiApplication([]) resources = Path(__file__).resolve().parents[1] / 'src' / 'QInventor' / 'resources' renderer = QtSvg.QSvgRenderer(str(resources / 'qinventor.svg')) image = QtGui.QImage(256, 256, QtGui.QImage.Format_ARGB32) image.fill(QtCore.Qt.transparent) painter = QtGui.QPainter(image) renderer.render(painter) painter.end() assert image.save(str(resources / 'qinventor.png'))