Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pixmap.invert_irect argument type error #3182

Closed
luhuaei opened this issue Feb 19, 2024 · 1 comment
Closed

Pixmap.invert_irect argument type error #3182

luhuaei opened this issue Feb 19, 2024 · 1 comment

Comments

@luhuaei
Copy link
Contributor

luhuaei commented Feb 19, 2024

Description of the bug

Pixmap.invert_irect

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.11/site-packages/fitz/__init__.py", line 9841, in invert_irect
    r = JM_irect_from_py(bbox)
        ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/fitz/__init__.py", line 16270, in JM_irect_from_py
    ret = mupdf.fz_make_irect(r.x0, r.y0, r.x1, r.y1)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/mupdf/__init__.py", line 39687, in fz_make_irect
    return _mupdf.fz_make_irect(x0, y0, x1, y1)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: in method 'fz_make_irect', argument 1 of type 'int'

How to reproduce the bug

>>> import fitz
>>> pix = fitz.Pixmap("screenshot.png")
>>> rect = fitz.Rect(0, 0, 100, 100)
>>> pix.invert_irect(rect)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.11/site-packages/fitz/__init__.py", line 9841, in invert_irect
    r = JM_irect_from_py(bbox)
        ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/fitz/__init__.py", line 16270, in JM_irect_from_py
    ret = mupdf.fz_make_irect(r.x0, r.y0, r.x1, r.y1)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/mupdf/__init__.py", line 39687, in fz_make_irect
    return _mupdf.fz_make_irect(x0, y0, x1, y1)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: in method 'fz_make_irect', argument 1 of type 'int'
>>> fitz.version
('1.23.23', '1.23.10', '20240218000001')
>>> 

Are the above usages not allowed now? I try below is work normal.

>>> pix.invert_irect([0, 0, 100, 100])
True
>>>

PyMuPDF version

1.23.23

Operating system

Linux

Python version

3.11

@julian-smith-artifex-com
Copy link
Collaborator

Fixed in 1.23.25.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants