2023-01-11
1分钟
douyacun
img = QImage("/Users/admin/Desktop/hello.png")
pimg = QPixmap.fromImage(image)
self.imgLabel.setPixmap(pimg)
img = QImage("/Users/admin/Desktop/hello.png")
pimg = QPixmap.fromImage(image)
self.imgLabel.setPixmap(pimg)
self.imgLabel.setScaledContents(True)
img = QImage("/Users/admin/Desktop/hello.png")
pimg = QPixmap.fromImage(image)
fw = self.imgLabel.width() / width
fh = self.imgLabel.height() / height
factor = min(fw, fh)
width = int(width * factor)
height = int(height * factor)
nimg = img.scaled(width, height, QtCore.Qt.KeepAspectRatio, QtCore.Qt.SmoothTransformation)
self.imgLabel.setPixmap(nimg)