mupdf_display_errors does not apply to Pixmap when loading broken image (original) (raw)

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