QT - 保存低分辨率 QPixmap

QT - Saving Lower Resolution QPixmap

我希望降低裁剪的 Qpixmap 的分辨率,然后将其保存为 png

   QPixmap original(imgPath); // read in the image that was selected from tree
   QPixmap cropped = original.copy(cropRectInt); // make copy of image that is cropped to the size of the rect

//***Convert cropped to lower res here***//

   QFile file("5.png");
   cropped.save(&file, "PNG"); // save for testing

   QByteArray byteArray;
   QBuffer buffer(&byteArray);
   cropped.save(&buffer, "PNG"); 
   QString imgBase64 = QString::fromLatin1(byteArray.toBase64().data()); 

尝试在调用中使用 quality 参数 QPixmap::save(QIODevice* device, const char* format, int quality)

可以参考this QT documentation