Uploaded image for project: 'Qt for Python'
  1. Qt for Python
  2. PYSIDE-1563

Crash When Creating QPixmap From QImage

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P2: Important
    • 5.15.4, 6.2.0
    • 5.15.2
    • PySide
    • None
    • Python 3.8.7 (tags/v3.8.7:6503f05, Dec 21 2020, 17:59:51) [MSC v.1928 64 bit (AMD64)]
    • Windows
    • a97698f0a5 (pyside/tqtc-pyside-setup/5.15.5) 2641a665fb (pyside/tqtc-pyside-setup/5.15.5)

    Description

      I am converting a project from PyQt5 to Pyside2 and have come accross a section of code that crashes the python interpretter when it runs (but only ~60% of the time???). The code takes a rendered PDF page image from PyMuPDF, converts it to a QImage, then to a QPixmap for display with a QGraphicsPixmapItem. The crash appears to occur on the 'QPixmap.fromImage' method call.

       

      import fitz
      from PySide2 import QtGui, QtWidgets
      
      fname = #Insert any PDF file path here
      pagenum = 3
              
      if __name__ == "__main__":
          import sys
          app = QtWidgets.QApplication(sys.argv)
      
          doc = fitz.open(fname)    
          page = doc[pagenum]
      
          pix = page.get_pixmap()
          doc.close()
          
          qimage = QtGui.QImage(pix.samples, pix.width, pix.height, pix.stride, \ 
                                QtGui.QImage.Format_RGB888)
              
          qpix = QtGui.QPixmap.fromImage(qimage)
          
          qtgi = QtWidgets.QGraphicsPixmapItem(qpix)
      

      Attachments

        1. pyside1563_linux_stack-1.txt
          26 kB
        2. pyside1563.zip
          5 kB
        3. simple loop slabs.pdf
          14 kB
        For Gerrit Dashboard: PYSIDE-1563
        # Subject Branch Project Status CR V

        Activity

          People

            kleint Friedemann Kleint
            bjhowie Ben Howue
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: