more
This commit is contained in:
parent
27fa67b04d
commit
2960b5f092
|
@ -2808,7 +2808,9 @@ let write_image pdf resources name image =
|
||||||
| Pdfimage.JPEG2000 (stream, _) -> write_stream (name ^ ".jpx") stream
|
| Pdfimage.JPEG2000 (stream, _) -> write_stream (name ^ ".jpx") stream
|
||||||
| Pdfimage.JBIG2 (stream, _) -> write_stream (name ^ ".jbig2") stream
|
| Pdfimage.JBIG2 (stream, _) -> write_stream (name ^ ".jbig2") stream
|
||||||
| Pdfimage.Raw (w, h, Pdfimage.BPP24, stream) ->
|
| Pdfimage.Raw (w, h, Pdfimage.BPP24, stream) ->
|
||||||
let fh = open_out_bin (name ^ ".pnm") in
|
let pnm = name ^ ".pnm" in
|
||||||
|
let png = name ^ ".png" in
|
||||||
|
let fh = open_out_bin pnm in
|
||||||
pnm_to_channel_24 fh w h stream;
|
pnm_to_channel_24 fh w h stream;
|
||||||
close_out fh;
|
close_out fh;
|
||||||
begin match args.path_to_p2p with
|
begin match args.path_to_p2p with
|
||||||
|
@ -2817,22 +2819,22 @@ let write_image pdf resources name image =
|
||||||
"" -> Printf.eprintf "Neither pnm2png nor imagemagick found. Specify with -p2p or -im\n"
|
"" -> Printf.eprintf "Neither pnm2png nor imagemagick found. Specify with -p2p or -im\n"
|
||||||
| _ ->
|
| _ ->
|
||||||
begin match
|
begin match
|
||||||
Sys.command (args.path_to_im ^ " " ^ "\"" ^ name ^ ".pnm\"" ^ " " ^ "\"" ^ name ^ ".png\"")
|
Sys.command (Filename.quote_command args.path_to_im [pnm; png])
|
||||||
with
|
with
|
||||||
0 -> Sys.remove (name ^ ".pnm");
|
0 -> Sys.remove pnm
|
||||||
| _ ->
|
| _ ->
|
||||||
Printf.eprintf "Call to imagemagick failed: did you specify -p2p correctly?\n";
|
Printf.eprintf "Call to imagemagick failed: did you specify -p2p correctly?\n";
|
||||||
Sys.remove (name ^ ".pnm")
|
Sys.remove pnm
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
| _ ->
|
| _ ->
|
||||||
begin match
|
begin match
|
||||||
Sys.command (args.path_to_p2p ^ " -gamma 0.45 -quiet " ^ "\"" ^ name ^ ".pnm\"" ^ "> \"" ^ name ^ ".png\"")
|
Sys.command (Filename.quote_command args.path_to_p2p ~stdout:png ["-gamma"; "0.45"; "-quiet"; pnm])
|
||||||
with
|
with
|
||||||
| 0 -> Sys.remove (name ^ ".pnm")
|
| 0 -> Sys.remove pnm
|
||||||
| _ ->
|
| _ ->
|
||||||
Printf.eprintf "Call to pnmtopng failed: did you specify -p2p correctly?\n";
|
Printf.eprintf "Call to pnmtopng failed: did you specify -p2p correctly?\n";
|
||||||
Sys.remove (name ^ ".pnm")
|
Sys.remove pnm
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
| _ ->
|
| _ ->
|
||||||
|
|
Loading…
Reference in New Issue