Different behavior of fitz.Pixmap() between PyMuPDF
1.23.8 and 1.23.15
#3057
-
With upgrading PyMuPdf 1.23.8>>> import fitz
>>> fitz.version
('1.23.8', '1.23.7', '20231219000001')
>>> doc = fitz.Document('sample.pdf')
>>> doc[0].get_images(full=True)
[(17, 0, 1731, 1331, 8, 'DeviceCMYK', '', 'Im0', 'DCTDecode', 0)]
>>> pix = fitz.Pixmap(doc, 17)
>>> pix.colorspace
Colorspace(CS_CMYK) - DeviceCMYK
>>> pix = fitz.Pixmap(fitz.csRGB, pix)
>>> pix.save('sample-1.png') <- perfect PyMuPdf 1.23.15>>> import fitz
>>> fitz.version
('1.23.15', '1.23.9', '20240116000001')
>>> doc = fitz.Document('sample.pdf')
>>> doc[0].get_images(full=True)
[(17, 0, 1731, 1331, 8, 'DeviceCMYK', '', 'Im0', 'DCTDecode', 0)] <- color space = DeviceCMYK
>>> pix = fitz.Pixmap(doc, 17)
>>> pix.colorspace
Colorspace(CS_RGB) - DeviceRGB <- color space seems changed to DeviceRGB
>>> pix = fitz.Pixmap(fitz.csRGB, pix)
>>> pix.save('sample-2.png') <- the png color is different from the source |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
Thanks for posting this. Looking now. |
Beta Was this translation helpful? Give feedback.
-
@dothinking - confirming your observation: |
Beta Was this translation helpful? Give feedback.
-
This is fixed in release 1.23.16. |
Beta Was this translation helpful? Give feedback.
@dothinking - confirming your observation:
The Pixmap made from the image is indeed converted to RGB but shouldn't: it should be CMYK.
Converting to a bug.