Skip to content

Commit

Permalink
Ensure QImage is ARGB32 before converting to numpy (#618)
Browse files Browse the repository at this point in the history
  • Loading branch information
aganders3 authored Dec 6, 2023
1 parent 33c5e60 commit 9d61830
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/magicgui/backends/_qtpy/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,8 @@ def _mgui_render(self) -> numpy.ndarray:
) from None

img = self._qwidget.grab().toImage()
if img.format() != QImage.Format_ARGB32:
img = img.convertToFormat(QImage.Format_ARGB32)
bits = img.constBits()
h, w, c = img.height(), img.width(), 4
if qtpy.API_NAME.startswith("PySide"):
Expand Down

0 comments on commit 9d61830

Please sign in to comment.