python – 抗锯齿PNG在Qt中调整大小?
发布时间:2020-12-20 11:20:50 所属栏目:Python 来源:网络整理
导读:在基于PyQt的GUI程序中,我在调整大小后将一些PNG文件绘制为QPixmap.所以这基本上是发生了什么: bitmap = QPixmap( "foo.png" )bitmap.scaleToHeight(38) # original is larger than thisscene.addItem(QGraphicsPixmapItem(bitmap)) # Add to graphics scen
在基于PyQt的GUI程序中,我在调整大小后将一些PNG文件绘制为QPixmap.所以这基本上是发生了什么:
bitmap = QPixmap( "foo.png" ) bitmap.scaleToHeight(38) # original is larger than this scene.addItem(QGraphicsPixmapItem(bitmap)) # Add to graphics scene 问题是:之后,位图相当丑陋.有没有办法以抗锯齿的方式做到这一点? 解决方法
见
documentation.
bitmap = bitmap.scaledToHeight(38,Qt.SmoothTransformation) (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |