Skip to content

Commit 9d61830

Browse files
authored
Ensure QImage is ARGB32 before converting to numpy (#618)
1 parent 33c5e60 commit 9d61830

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/magicgui/backends/_qtpy/widgets.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,8 @@ def _mgui_render(self) -> numpy.ndarray:
181181
) from None
182182

183183
img = self._qwidget.grab().toImage()
184+
if img.format() != QImage.Format_ARGB32:
185+
img = img.convertToFormat(QImage.Format_ARGB32)
184186
bits = img.constBits()
185187
h, w, c = img.height(), img.width(), 4
186188
if qtpy.API_NAME.startswith("PySide"):

0 commit comments

Comments
 (0)