Scaffolding for dpi threshold
This commit is contained in:
parent
f775ae304b
commit
3a39b5497a
|
@ -529,6 +529,7 @@ type args =
|
||||||
mutable pixel_threshold : int;
|
mutable pixel_threshold : int;
|
||||||
mutable length_threshold : int;
|
mutable length_threshold : int;
|
||||||
mutable percentage_threshold : int;
|
mutable percentage_threshold : int;
|
||||||
|
mutable dpi_threshold : int;
|
||||||
mutable resample_factor : int;
|
mutable resample_factor : int;
|
||||||
mutable resample_interpolate : bool}
|
mutable resample_interpolate : bool}
|
||||||
|
|
||||||
|
@ -660,6 +661,7 @@ let args =
|
||||||
pixel_threshold = 25;
|
pixel_threshold = 25;
|
||||||
length_threshold = 100;
|
length_threshold = 100;
|
||||||
percentage_threshold = 99;
|
percentage_threshold = 99;
|
||||||
|
dpi_threshold = 0;
|
||||||
resample_factor = 101;
|
resample_factor = 101;
|
||||||
resample_interpolate = false}
|
resample_interpolate = false}
|
||||||
|
|
||||||
|
@ -777,6 +779,7 @@ let reset_arguments () =
|
||||||
args.pixel_threshold <- 25;
|
args.pixel_threshold <- 25;
|
||||||
args.length_threshold <- 100;
|
args.length_threshold <- 100;
|
||||||
args.percentage_threshold <- 99;
|
args.percentage_threshold <- 99;
|
||||||
|
args.dpi_threshold <- 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
|
||||||
|
@ -1962,6 +1965,9 @@ let setlengththreshold i =
|
||||||
let setpercentagethreshold i =
|
let setpercentagethreshold i =
|
||||||
args.percentage_threshold <- i
|
args.percentage_threshold <- i
|
||||||
|
|
||||||
|
let setdpithreshold i =
|
||||||
|
args.dpi_threshold <- i
|
||||||
|
|
||||||
let setlosslessresample i =
|
let setlosslessresample i =
|
||||||
args.resample_factor <- i
|
args.resample_factor <- i
|
||||||
|
|
||||||
|
@ -2772,6 +2778,9 @@ and specs =
|
||||||
("-percentage-threshold",
|
("-percentage-threshold",
|
||||||
Arg.Int setpercentagethreshold,
|
Arg.Int setpercentagethreshold,
|
||||||
" Only substitute lossy image when smaller than this");
|
" Only substitute lossy image when smaller than this");
|
||||||
|
("-dpi-threshold",
|
||||||
|
Arg.Int setdpithreshold,
|
||||||
|
" Only process image when always higher than this dpi");
|
||||||
("-lossless-resample",
|
("-lossless-resample",
|
||||||
Arg.Int setlosslessresample,
|
Arg.Int setlosslessresample,
|
||||||
" Resample lossless images to given part of original");
|
" Resample lossless images to given part of original");
|
||||||
|
@ -4518,7 +4527,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
|
||||||
~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_convert range pdf;
|
||||||
write_pdf false pdf
|
write_pdf false pdf
|
||||||
|
|
||||||
|
|
|
@ -718,8 +718,8 @@ let recompress_1bpp_jbig2_lossless ~pixel_threshold ~length_threshold ~path_to_j
|
||||||
- Downsample colours as well as pixels
|
- Downsample colours as well as pixels
|
||||||
- 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 ~factor ~interpolate
|
?q ?qlossless ?onebppmethod ~length_threshold ~percentage_threshold ~pixel_threshold ~dpi_threshold
|
||||||
~path_to_jbig2enc ~path_to_convert range pdf
|
~factor ~interpolate ~path_to_jbig2enc ~path_to_convert range pdf
|
||||||
=
|
=
|
||||||
let inrange =
|
let inrange =
|
||||||
match images pdf range with
|
match images pdf range with
|
||||||
|
|
|
@ -14,10 +14,11 @@ val image_resolution : Pdf.t -> int list -> float -> (int * string * int * int *
|
||||||
(** List images in JSON format *)
|
(** List images in JSON format *)
|
||||||
val images : Pdf.t -> int list -> Cpdfyojson.Safe.t
|
val images : Pdf.t -> int list -> Cpdfyojson.Safe.t
|
||||||
|
|
||||||
|
(** Reprocess images *)
|
||||||
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 ->
|
||||||
factor:int -> interpolate:bool ->
|
dpi_threshold: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
|
||||||
|
|
||||||
(**/**)
|
(**/**)
|
||||||
|
|
Loading…
Reference in New Issue