Loading images

319 views
Skip to first unread message

Patrick Kreitzberg

unread,
Jul 19, 2017, 1:16:27 PM7/19/17
to pyqtgraph
Hi,

I am working with a large-ish data set which I currently graph by loading the array into a colormap than loading that array into an imageitem.  My problem is that once I run the data through a colormap and plot the data  ~90 seconds has gone by, and the user may want to select between several data sets all of the same size.  I am hoping to speed that up by reading in an image file that I saved using ImageItem.save().

Can anyone show me an example of how to do this?

I can load the image into a QImage using
qi = QtGui.QImage()
qi.load('./image.png')

But I am not sure how to get the QImage into a plotwidget or similar widget in order to graph the jpg into the QMainWindow.

Thanks

vas...@gmail.com

unread,
Jul 19, 2017, 2:19:07 PM7/19/17
to pyqt...@googlegroups.com
Found the way to load a QImage into the label on GraphicsLayoutWidget.

Cheers,
Vasilije

import pyqtgraph

app = pyqtgraph.QtGui.QApplication([])
win = pyqtgraph.GraphicsLayoutWidget()
qi = pyqtgraph.QtGui.QImage()
label = pyqtgraph.QtGui.QLabel(win)

qi.load('image.png')
label.setPixmap(pyqtgraph.QtGui.QPixmap.fromImage(qi))

win.show()


if __name__ == '__main__':
    import sys
    if (sys.flags.interactive != 1) or not hasattr(QtCore, 'PYQT_VERSION'):
        pyqtgraph.QtGui.QApplication.instance().exec_()


--
You received this message because you are subscribed to the Google Groups "pyqtgraph" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyqtgraph+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pyqtgraph/fc7ccf60-eae3-4905-861e-b5239daaab73%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages