Python研究ノート-Qimage

1.Qimageの長さと幅を取得します

from PyQt5 import QtGui

qimage = QtGui.QImage('C:/Users/wxscn/Desktop/test.jpg')
# 直接打印rect得不到长宽
rect = qimage.rect()
# 第1种获取长宽的方法
w = rect.width()
h = rect.height()
# 第2种获取长宽的方法
w_ = qimage.width()
h_ = qimage.height()
print(rect, (w, h), (w_, h_))

演算結果:PyQt5.QtCore.QRect(0、0、536、868)(536、868)(536、868)

おすすめ

転載: blog.csdn.net/wxsy024680/article/details/114894277