You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If a pixmap pix0 has a colorspace unsupported by MuPDF (i.e. one generated from image files), trial to convert it with pix1 = fitz.Pixmap(my_cspace, pix0) will crash the Python interpreter.
This can e.g. occur when the image source contains only black & white with no alpha channel. Then pix0.n will equal 1.
Fix:
Check 2 <= pix0.n <= 5 and raise an exception otherwise. This has been tested already and will soon be uploaded.
Circumvention:
Amazingly, pix0.writePNG(...) and pix0.getPNGData() will still both work in such situations! So, whenever pix0.n is not in valid range, do pix00 = fitz.Pixmap(pix0.getPNGData()) and then do pix1 = fitz.Pixmap(my_cspace, pix00)
The text was updated successfully, but these errors were encountered:
If a pixmap
pix0
has a colorspace unsupported by MuPDF (i.e. one generated from image files), trial to convert it withpix1 = fitz.Pixmap(my_cspace, pix0)
will crash the Python interpreter.This can e.g. occur when the image source contains only black & white with no alpha channel. Then pix0.n will equal 1.
Fix:
Check
2 <= pix0.n <= 5
and raise an exception otherwise. This has been tested already and will soon be uploaded.Circumvention:
Amazingly,
pix0.writePNG(...)
andpix0.getPNGData()
will still both work in such situations! So, whenever pix0.n is not in valid range, dopix00 = fitz.Pixmap(pix0.getPNGData())
and then dopix1 = fitz.Pixmap(my_cspace, pix00)
The text was updated successfully, but these errors were encountered: