From cab89111d9c98177d2942ddcdfbdf3042943e7e3 Mon Sep 17 00:00:00 2001 From: "Jorj X. McKie" Date: Thu, 26 Nov 2026 10:26:41 -0400 Subject: [PATCH] Fix #5310 Prevent conversion of masked images to JPEG. --- src/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/__init__.py b/src/__init__.py index f55990c1c..dd88e8a37 100644 --- a/src/__init__.py +++ b/src/__init__.py @@ -21597,8 +21597,8 @@ def _make_image_dict(img, img_dict): mupdf.FzColorParams(mupdf.fz_default_color_params), ) ext = "png" - elif ext == "jpeg" and img.n() == 4: - # JPEG with CMYK: invert colors + elif ext == "jpeg" and img.n() == 4 and not img.mask().fz_image_size(): + # JPEG with CMYK, no mask: invert colors res = mupdf.fz_new_buffer_from_image_as_jpeg( img, mupdf.FzColorParams(mupdf.fz_default_color_params),