From 9426ef0391308f2f98e575dde7ba30e97e3b2b26 Mon Sep 17 00:00:00 2001 From: KIU Shueng Chuan Date: Sat, 22 May 2021 09:10:03 +0800 Subject: [PATCH] don't rely on QImage-wrapped buffer being writable --- pyqtgraph/graphicsItems/ImageItem.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pyqtgraph/graphicsItems/ImageItem.py b/pyqtgraph/graphicsItems/ImageItem.py index 016dda9d..3955531f 100644 --- a/pyqtgraph/graphicsItems/ImageItem.py +++ b/pyqtgraph/graphicsItems/ImageItem.py @@ -235,7 +235,7 @@ class ImageItem(GraphicsObject): self._processingBuffer = self._xp.empty(shape[:2] + (4,), dtype=self._xp.ubyte) else: self._processingBuffer = self._displayBuffer - self.qimage = fn.makeQImage(self._displayBuffer, transpose=False, copy=False) + self.qimage = None def setImage(self, image=None, autoLevels=None, **kargs): """ @@ -471,6 +471,7 @@ class ImageItem(GraphicsObject): fn.makeARGB(image, lut=lut, levels=levels, output=self._processingBuffer) if self._xp == getCupy(): self._processingBuffer.get(out=self._displayBuffer) + self.qimage = fn.ndarray_to_qimage(self._displayBuffer, QtGui.QImage.Format.Format_ARGB32) self._renderRequired = False self._unrenderable = False