From 8b38b18ec7d69d0368e127426a4452fbf76f611f Mon Sep 17 00:00:00 2001 From: John Whitington Date: Thu, 22 Feb 2024 15:56:35 +0000 Subject: [PATCH] convert -> magick --- cpdfcommand.ml | 10 +--------- cpdfimage.ml | 6 +++--- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/cpdfcommand.ml b/cpdfcommand.ml index a0a4237..502557b 100644 --- a/cpdfcommand.ml +++ b/cpdfcommand.ml @@ -477,7 +477,6 @@ type args = mutable path_to_ghostscript : string; mutable path_to_im : string; mutable path_to_p2p : string; - mutable path_to_convert : string; mutable path_to_jbig2enc : string; mutable frombox : string option; mutable tobox : string option; @@ -611,7 +610,6 @@ let args = path_to_ghostscript = ""; path_to_im = ""; path_to_p2p = ""; - path_to_convert = ""; path_to_jbig2enc = ""; frombox = None; tobox = None; @@ -1515,9 +1513,6 @@ let setimageresolution f = let setimpath p = args.path_to_im <- p -let setconvertpath p = - args.path_to_convert <- p - let setjbig2encpath p = args.path_to_jbig2enc <- p @@ -2661,9 +2656,6 @@ and specs = ("-process-images-info", Arg.Unit setprocessimagesinfo, " Show info when processing images"); - ("-convert", - Arg.String setconvertpath, - " Path to convert executable"); ("-jbig2enc", Arg.String setjbig2encpath, " Path to jbig2enc executable"); @@ -4468,7 +4460,7 @@ let go () = ~q:args.jpegquality ~qlossless:args.jpegqualitylossless ~onebppmethod:args.onebppmethod ~jbig2_lossy_threshold:args.jbig2_lossy_threshold ~length_threshold:args.length_threshold ~percentage_threshold:args.percentage_threshold ~pixel_threshold:args.pixel_threshold ~dpi_threshold:args.dpi_threshold ~factor:args.resample_factor ~interpolate:args.resample_interpolate - ~path_to_jbig2enc:args.path_to_jbig2enc ~path_to_convert:args.path_to_convert range pdf; + ~path_to_jbig2enc:args.path_to_jbig2enc ~path_to_convert:args.path_to_im range pdf; write_pdf false pdf | Some (ExtractStream i) -> let pdf = get_single_pdf args.op false in diff --git a/cpdfimage.ml b/cpdfimage.ml index 31b51a5..9048aba 100644 --- a/cpdfimage.ml +++ b/cpdfimage.ml @@ -8,7 +8,7 @@ let complain_jbig2enc path = if path = "" then error "Specify jbig2enc location with -jbig2enc" let complain_convert path = - if path = "" then error "Specify convert location with -convert" + if path = "" then error "Specify magick location with -im" let remove x = try (*Printf.printf "%s\n" x;*) Sys.remove x with _ -> () @@ -671,9 +671,9 @@ let lossless_resample pdf ~pixel_threshold ~length_threshold ~factor ~interpolat let retcode = let command = Filename.quote_command path_to_convert - ((if components = 4 then ["-depth"; "8"; "-size"; string_of_int w ^ "x" ^ string_of_int h] else []) @ + ([out] @ (if components = 4 then ["-depth"; "8"; "-size"; string_of_int w ^ "x" ^ string_of_int h] else []) @ (if components = 1 then ["-define"; "png:color-type=0"; "-colorspace"; "Gray"] else if components = 3 then ["-define"; "-png:color-type=2"; "-colorspace"; "RGB"] else if components = 4 then ["-colorspace"; "CMYK"] else []) @ - [if interpolate && components > -2 then "-resize" else "-sample"; string_of_float factor ^ "%"; out; out2]) + [if interpolate && components > -2 then "-resize" else "-sample"; string_of_float factor ^ "%"; out2]) in (*Printf.printf "%S\n" command;*) Sys.command command