Bitmap/Read a PPM file: Difference between revisions

Line 173:
g_channel,
b_channel)</ocaml>
 
and converting a color file to grayscale:
<ocaml>let () =
let img = read_ppm ~filename:"logo.ppm" in
let img = to_color(to_grayscale ~img) in
output_ppm ~oc:stdout ~img;
;;</ocaml>
sending the result to <code>stdout</code> allows to see the result without creating a temporary file sending it through a pipe to the '''display''' from ''ImageMagick'':
ocaml script.ml | display -