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

mupdf_display_errors does not apply to Pixmap when loading broken image #2251

Closed
stefan6419846 opened this issue Feb 24, 2023 · 3 comments
Closed
Labels
upstream bug bug outside this package

Comments

@stefan6419846
Copy link

Describe the bug

Loading a partially broken image, which libjpeg-turbo(?) reports a warning about, does not respect setting mupdf_display_errors(False), thus spamming the output.

To Reproduce

import fitz


fitz.TOOLS.mupdf_display_errors(False)
print(fitz.Pixmap('invalid-sos.jpg'))
print(fitz.TOOLS.mupdf_warnings(reset=True))

The broken file is taken from https://github.com/asilvas/node-image-steam/blob/master/test/files/invalid-sos.jpg In my specific case, such images are embedded into a PDF I am extracting the images of, but this simple example raises this error as well.

Output is:

Invalid SOS parameters for sequential JPEG
Pixmap(DeviceRGB, IRect(0, 0, 4032, 3024), 0)

Expected behavior

Hiding MuPDF warnings should allow controlling all warnings, not only the direct ones, thus not printing Invalid SOS parameters for sequential JPEG.

Your configuration

  • OpenSUSE Leap 15.3, 64-bit
  • Python 3.7, 64-bit
  • PyMuPDF 1.12.1, generated from source
@JorjMcKie
Copy link
Collaborator

This message is not issued by (Py-) MuPDF. Therefore it is not being suppressed by the settings you used. We are checking which of the thirdparty libraries issues the message, and whether there ways to suppress it ... or not.

@JorjMcKie
Copy link
Collaborator

Just confirming that this message is issued by one of the thirdparty packages used by MuPDF, libjpeg.
So MuPDF's own message filtering has no way to intercept it.
In libjpeg, this is a warning. I will forward your inquiry to our experts to see whether suppression is possible.

@JorjMcKie JorjMcKie added the postpone postpone to a future version label Mar 10, 2023
@julian-smith-artifex-com
Copy link
Collaborator

I think mupdf has been recently changed to stop libjpeg messages from appearing. See: https://git.ghostscript.com/?p=mupdf.git;a=commitdiff;h=fa6a4abf475cd2

So marking this issue as fixed in next release.

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

No branches or pull requests

3 participants