mirror of
				https://github.com/johnwhitington/cpdf-source.git
				synced 2025-06-05 22:09:39 +02:00 
			
		
		
		
	convert -> magick
This commit is contained in:
		| @@ -477,7 +477,6 @@ type args = | |||||||
|    mutable path_to_ghostscript : string; |    mutable path_to_ghostscript : string; | ||||||
|    mutable path_to_im : string; |    mutable path_to_im : string; | ||||||
|    mutable path_to_p2p : string; |    mutable path_to_p2p : string; | ||||||
|    mutable path_to_convert : string; |  | ||||||
|    mutable path_to_jbig2enc : string; |    mutable path_to_jbig2enc : string; | ||||||
|    mutable frombox : string option; |    mutable frombox : string option; | ||||||
|    mutable tobox : string option; |    mutable tobox : string option; | ||||||
| @@ -611,7 +610,6 @@ let args = | |||||||
|    path_to_ghostscript = ""; |    path_to_ghostscript = ""; | ||||||
|    path_to_im = ""; |    path_to_im = ""; | ||||||
|    path_to_p2p = ""; |    path_to_p2p = ""; | ||||||
|    path_to_convert = ""; |  | ||||||
|    path_to_jbig2enc = ""; |    path_to_jbig2enc = ""; | ||||||
|    frombox = None; |    frombox = None; | ||||||
|    tobox = None; |    tobox = None; | ||||||
| @@ -1515,9 +1513,6 @@ let setimageresolution f = | |||||||
| let setimpath p = | let setimpath p = | ||||||
|   args.path_to_im <- p |   args.path_to_im <- p | ||||||
|  |  | ||||||
| let setconvertpath p = |  | ||||||
|   args.path_to_convert <- p |  | ||||||
|  |  | ||||||
| let setjbig2encpath p = | let setjbig2encpath p = | ||||||
|   args.path_to_jbig2enc <- p |   args.path_to_jbig2enc <- p | ||||||
|  |  | ||||||
| @@ -2661,9 +2656,6 @@ and specs = | |||||||
|    ("-process-images-info", |    ("-process-images-info", | ||||||
|      Arg.Unit setprocessimagesinfo, |      Arg.Unit setprocessimagesinfo, | ||||||
|      " Show info when processing images"); |      " Show info when processing images"); | ||||||
|    ("-convert", |  | ||||||
|      Arg.String setconvertpath, |  | ||||||
|      " Path to convert executable"); |  | ||||||
|    ("-jbig2enc", |    ("-jbig2enc", | ||||||
|      Arg.String setjbig2encpath, |      Arg.String setjbig2encpath, | ||||||
|      " Path to jbig2enc executable"); |      " 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 |           ~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  |           ~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 |           ~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 |         write_pdf false pdf | ||||||
|   | Some (ExtractStream i) -> |   | Some (ExtractStream i) -> | ||||||
|       let pdf = get_single_pdf args.op false in |       let pdf = get_single_pdf args.op false in | ||||||
|   | |||||||
| @@ -8,7 +8,7 @@ let complain_jbig2enc path = | |||||||
|   if path = "" then error "Specify jbig2enc location with -jbig2enc" |   if path = "" then error "Specify jbig2enc location with -jbig2enc" | ||||||
|  |  | ||||||
| let complain_convert path = | 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 = | let remove x = | ||||||
|   try (*Printf.printf "%s\n" x;*) Sys.remove x with _ -> () |   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 retcode = | ||||||
|     let command =  |     let command =  | ||||||
|       Filename.quote_command path_to_convert |       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 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 |     in | ||||||
|       (*Printf.printf "%S\n" command;*) |       (*Printf.printf "%S\n" command;*) | ||||||
|       Sys.command command |       Sys.command command | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user