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

python3.9 pix.set_pixel has something wrong in c.append( ord(i)) #3050

Closed
caimaoy opened this issue Jan 16, 2024 · 2 comments
Closed

python3.9 pix.set_pixel has something wrong in c.append( ord(i)) #3050

caimaoy opened this issue Jan 16, 2024 · 2 comments
Labels
fix developed release schedule to be determined

Comments

@caimaoy
Copy link

caimaoy commented Jan 16, 2024

Description of the bug

python3.9 pix.set_pixel(pos[0], pos[1], (255, 255, 255))
with the error

/lib/python3.9/site-packages/fitz/__init__.py", line 10131, in set_pixel
    c.append( ord(i))

How to reproduce the bug

The code is like this, has some wrong with python3.9, but it works with python3.7

   pdf_file = fitz.open(input_pdf_path)

        for page_no, page in enumerate(pdf_file):
            zoom_x = 4.0
            zoom_y = 4.0
            matrix = fitz.Matrix(zoom_x, zoom_y)
            pix = page.get_pixmap(matrix=matrix)

            for pos in product(range(pix.width), range(pix.height)):
                if sum(pix.pixel(pos[0], pos[1])) >= 600:
                    pix.set_pixel(pos[0], pos[1], (255, 255, 255))

PyMuPDF version

1.23.12

Operating system

MacOS

Python version

3.9

julian-smith-artifex-com added a commit that referenced this issue Jan 16, 2024
Also added optimisation in src.extra.i.

Addresses #3050.
@julian-smith-artifex-com
Copy link
Collaborator

Thanks for reporting this.

I have a fix in branch jules-3050. This is in review, and will hopefully be in a new release later today.

@julian-smith-artifex-com julian-smith-artifex-com added the fix developed release schedule to be determined label Jan 16, 2024
julian-smith-artifex-com added a commit that referenced this issue Jan 16, 2024
Also added optimisation in src.extra.i.

Addresses #3050.
@julian-smith-artifex-com
Copy link
Collaborator

Fixed in 1.23.15.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix developed release schedule to be determined
Projects
None yet
Development

No branches or pull requests

2 participants