Here is the complete answer:
QImage QPixmap::toImage()
If pixmap has a 1-bit depth, the returned image will also have a depth of 1 bit. Images with a large number of bits will be returned in a format that represents the underlying system. Usually it will be QImage :: Format_ARGB32_Premultiplied for pixmaps with alpha and QImage :: Format_RGB32 or QImage :: Format_RGB16 for pixmaps without alpha.
QImage img = QIcon("filepath.svg").pixmap(QSize(requiredsize)).toImage()
Also copy the answer above
// Save, image format based on file extension image.save("./svg-logo-h.png");
Yash May 13 '16 at 8:30 a.m. 2016-05-13 08:30
source share