标签:get app hid ann format lap %s ati nump
Read OIIO->Qt QImage
import sys,os import OpenImageIO as oiio from PySide2 import QtWidgets,QtCore,QtGui import numpy as np if __name__ == "__main__": img_input = oiio.ImageInput.open(‘timg.jpg‘) img_spec = img_input.spec() nchans = img_spec.nchannels # JPG is 3 / PNG is 4 width = img_spec.width height = img_spec.height print("img width:%s,height:%s"%(width,height)) #pixels = [] pixels = img_input.read_image(oiio.UINT8) pixels = pixels.flatten() print(len(pixels) ) print(width*height*nchans) app = QtWidgets.QApplication(sys.argv) qtimg = QtGui.QImage(pixels,width,height,QtGui.QImage.Format_RGB888) # CREATGE QT IMAGE #qtimg.save(‘test.jpg‘) print(‘Create Pixmap‘) qtimg = QtGui.QPixmap.fromImage(qtimg) label = QtWidgets.QLabel() label.resize(500,500) label.setPixmap(qtimg) label.show() app.exec_()
标签:get app hid ann format lap %s ati nump
原文地址:https://www.cnblogs.com/gearslogy/p/12129234.html