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(pixmap.irect) take 7 seconds #3498

Closed
manateelazycat opened this issue May 17, 2024 · 3 comments
Closed

pixmap.invert_irect(pixmap.irect) take 7 seconds #3498

manateelazycat opened this issue May 17, 2024 · 3 comments

Comments

@manateelazycat
Copy link

manateelazycat commented May 17, 2024

Description of the bug

I am the author of eaf-pdf-viewer (https://github.com/emacs-eaf/eaf-pdf-viewer). One of the features of this PDF reader is to support dark mode.

Recently, I don’t know whether it is pymupdf or the upgrade of the underlying library that causes pixmap.invert_irect(pixmap.irect) to be very slow. It takes 6 to 7 seconds to execute it once.

The problematic code is at: https://github.com/emacs-eaf/eaf-pdf-viewer/blob/0b79e9000551200b6a0d2206de14b87d9ed3c9c9/eaf_pdf_page.py#L198

How to reproduce the bug

  1. Start emacs with dark theme
  2. Install EAF
  3. Open any pdf file
  4. pixmap.invert_irect(pixmap.irect) block EAF

PyMuPDF version

1.24.4

Operating system

Linux

Python version

3.12

截图 2024-05-17 23-51-02

@manateelazycat
Copy link
Author

And when invert_direct is called, the returned pixmap is wrong. There is a black rectangle on the right and the font is hollow.

@JorjMcKie
Copy link
Collaborator

Can we have a PDF page please and the code which produces a pixmap from it?
To accept a bug, we can only deal with reproducible data requiring no extra installations.

@JorjMcKie
Copy link
Collaborator

Closing this for lack of response for more than a week.

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

3 participants