Scaffolding for DPI target

This commit is contained in:
John Whitington 2024-01-10 14:19:57 +00:00
parent 9af9c13912
commit da78de8964
3 changed files with 12 additions and 3 deletions

View File

@ -530,6 +530,7 @@ type args =
mutable length_threshold : int; mutable length_threshold : int;
mutable percentage_threshold : int; mutable percentage_threshold : int;
mutable dpi_threshold : int; mutable dpi_threshold : int;
mutable dpi_target : int;
mutable resample_factor : int; mutable resample_factor : int;
mutable resample_interpolate : bool} mutable resample_interpolate : bool}
@ -662,6 +663,7 @@ let args =
length_threshold = 100; length_threshold = 100;
percentage_threshold = 99; percentage_threshold = 99;
dpi_threshold = 0; dpi_threshold = 0;
dpi_target = 0;
resample_factor = 101; resample_factor = 101;
resample_interpolate = false} resample_interpolate = false}
@ -780,6 +782,7 @@ let reset_arguments () =
args.length_threshold <- 100; args.length_threshold <- 100;
args.percentage_threshold <- 99; args.percentage_threshold <- 99;
args.dpi_threshold <- 0; args.dpi_threshold <- 0;
args.dpi_target <- 0;
args.resample_factor <- 101; args.resample_factor <- 101;
args.resample_interpolate <- false; args.resample_interpolate <- false;
clear Cpdfdrawcontrol.fontpack_initialised clear Cpdfdrawcontrol.fontpack_initialised
@ -1968,6 +1971,9 @@ let setpercentagethreshold i =
let setdpithreshold i = let setdpithreshold i =
args.dpi_threshold <- i args.dpi_threshold <- i
let setdpitarget i =
args.dpi_target <- i
let setlosslessresample i = let setlosslessresample i =
args.resample_factor <- i args.resample_factor <- i
@ -2787,6 +2793,9 @@ and specs =
("-resample-interpolate", ("-resample-interpolate",
Arg.Unit setresampleinterpolate, Arg.Unit setresampleinterpolate,
" Interpolate when resampling"); " Interpolate when resampling");
("-dpi-target",
Arg.Int setdpitarget,
" Resample to this dpi when using -lossless-resample");
("-squeeze", ("-squeeze",
Arg.Unit setsqueeze, Arg.Unit setsqueeze,
" Squeeze"); " Squeeze");
@ -4527,7 +4536,7 @@ let go () =
Cpdfimage.process Cpdfimage.process
~q:args.jpegquality ~qlossless:args.jpegqualitylossless ~onebppmethod:args.onebppmethod ~q:args.jpegquality ~qlossless:args.jpegqualitylossless ~onebppmethod:args.onebppmethod
~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 ~dpi_target:args.dpi_target ~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_convert range pdf;
write_pdf false pdf write_pdf false pdf

View File

@ -716,7 +716,7 @@ let recompress_1bpp_jbig2_lossless ~pixel_threshold ~length_threshold ~path_to_j
- JBIG2 with refinement coding for multipage lossless? *) - JBIG2 with refinement coding for multipage lossless? *)
let process let process
?q ?qlossless ?onebppmethod ~length_threshold ~percentage_threshold ~pixel_threshold ~dpi_threshold ?q ?qlossless ?onebppmethod ~length_threshold ~percentage_threshold ~pixel_threshold ~dpi_threshold
~factor ~interpolate ~path_to_jbig2enc ~path_to_convert range pdf ~dpi_target ~factor ~interpolate ~path_to_jbig2enc ~path_to_convert range pdf
= =
let inrange = let inrange =
match images pdf range with match images pdf range with

View File

@ -18,7 +18,7 @@ val images : Pdf.t -> int list -> Cpdfyojson.Safe.t
val process : val process :
?q:int -> ?qlossless:int -> ?onebppmethod:string -> ?q:int -> ?qlossless:int -> ?onebppmethod:string ->
length_threshold:int -> percentage_threshold:int -> pixel_threshold:int -> length_threshold:int -> percentage_threshold:int -> pixel_threshold:int ->
dpi_threshold:int -> factor:int -> interpolate:bool -> dpi_threshold:int -> dpi_target:int -> factor:int -> interpolate:bool ->
path_to_jbig2enc:string -> path_to_convert:string -> int list -> Pdf.t -> unit path_to_jbig2enc:string -> path_to_convert:string -> int list -> Pdf.t -> unit
(**/**) (**/**)