PyQt5中奇怪显示中的图像加载

我正在使用PyQt5开发可加载简单PPM格式图像的应用。

大多数PPM格式的图像都能很好地加载。但是其中只有一张图片以一种奇怪的方式坚持着。

在左侧加载良好的PPM格式图像。右边的PPM图像在我的应用程序中加载异常,但在GIMP和其他图像编辑器软件中完美加载。有提示吗?

PyQt5中奇怪显示中的图像加载

这是在GIMP中加载相同图像(右侧)的方式:

PyQt5中奇怪显示中的图像加载

要使用PyQt5教程中的默认代码加载图像,如下所示:

self.image1 = QLabel(self)
self.path1 = 'images/original.ppm'
self.pixmap1 = QtGui.QPixmap(self.path1)
self.pixmap1 = self.pixmap1.scaled(250,250,QtCore.Qt.KeepAspectRatio)
self.image1.setPixmap(self.pixmap1)
self.image1.setalignment(QtCore.Qt.AlignCenter)


self.image2 = QLabel(self)
self.path2 = 'images/original_sharpen.ppm'
self.pixmap2 = QtGui.QPixmap(self.path2)
self.pixmap2 = self.pixmap2.scaled(250,QtCore.Qt.KeepAspectRatio)
self.image2.setPixmap(self.pixmap2)
self.image2.setalignment(QtCore.Qt.AlignCenter)

任何帮助将不胜感激。预先感谢。

iCMS 回答:PyQt5中奇怪显示中的图像加载

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/2034477.html

大家都在问