缩放的QPixmap看起来很糟糕

2024-09-30 00:33:33 发布

您现在位置:Python中文网/ 问答频道 /正文

我有以下小部件:

pixmap = QtGui.QPixmap(r'pics\cdaudio.png').scaled(100, 100)

图像从256x256缩小。它看起来很起伏:

enter image description here

如何从Qt内平滑地缩放它


Tags: 图像png部件qtqtguiscaledpicsqpixmap
2条回答

根据@iTayb,我想到了以下几点:

// Scale the source to the requested size with 
//  the KeepAspectRatio as aspectMode & SmoothTransformation as mode
*source = source->scaled(width, height, Qt::KeepAspectRatio, Qt::SmoothTransformation);
target->setPixmap(*source);

如果可能,为什么不使用SVG格式(以及Qt SVG模块)

相关问题 更多 >

    热门问题