fitz.Pixmap(None, pix) Unrecognised args for constructing Pixmap (original) (raw)

Description of the bug

    pixalpha = fitz.Pixmap(None, pixmap)
               ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/fitz/__init__.py", line 9723, in __init__
    raise Exception( text)
Exception: Unrecognised args for constructing Pixmap:
    <class 'NoneType'>: None
    <class 'fitz.Pixmap'>: Pixmap(DeviceRGB, (0, 0, 1920, 2485), 1)

How to reproduce the bug

read the document

>>> import fitz
>>> pix = fitz.Pixmap("screenshot.png")
>>> pix
Pixmap(DeviceRGB, (0, 0, 3840, 2400), 1)
>>> alpha = fitz.Pixmap(None, pix)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.11/site-packages/fitz/__init__.py", line 9723, in __init__
    raise Exception( text)
Exception: Unrecognised args for constructing Pixmap:
    <class 'NoneType'>: None
    <class 'fitz.Pixmap'>: Pixmap(DeviceRGB, (0, 0, 3840, 2400), 1)

>>> fitz.version 
('1.23.22', '1.23.10', '20240212000001')
>>> 

PyMuPDF version

1.23.22

Operating system

Linux

Python version

3.11