From b3ed5a7e8b6aba09baf28b20a7e21c0ec4f4f085 Mon Sep 17 00:00:00 2001 From: John Whitington Date: Wed, 21 Feb 2024 17:03:22 +0000 Subject: [PATCH] Prevent indexed colourspace images being JPEGd --- cpdfimage.ml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cpdfimage.ml b/cpdfimage.ml index 5a3b5a9..e15c05a 100644 --- a/cpdfimage.ml +++ b/cpdfimage.ml @@ -606,7 +606,11 @@ let lossless_out pdf ~pixel_threshold ~length_threshold extension s dict referen let lossless_to_jpeg pdf ~pixel_threshold ~length_threshold ~percentage_threshold ~qlossless ~path_to_convert s dict reference = complain_convert path_to_convert; - match lossless_out pdf ~pixel_threshold ~length_threshold ".jpg" s dict reference with None -> () | Some (out, out2, size, components, w, h) -> + match lossless_out pdf ~pixel_threshold ~length_threshold ".jpg" s dict reference with + | None -> () + | Some (_, _, _, -2, _, _) -> + if !debug_image_processing then Printf.printf "skipping indexed colorspace\n%!" + | Some (out, out2, size, components, w, h) -> let retcode = let command = (Filename.quote_command path_to_convert