Bitmap/Read an image through a pipe: Difference between revisions
Content added Content deleted
m (category: less than 20 examples) |
(added OCaml) |
||
Line 39: | Line 39: | ||
return NULL; |
return NULL; |
||
}</lang> |
}</lang> |
||
=={{header|OCaml}}== |
|||
The <code>read_ppm</code> function of the page [[read ppm file]] and used by the code below would need to be changed to take as parameter an input channel instead of the filename. |
|||
<lang ocaml>let read_image ~filename = |
|||
if not(Sys.file_exists filename) |
|||
then failwith(Printf.sprintf "the file %s does not exist" filename); |
|||
let cmd = Printf.sprintf "convert \"%s\" ppm:-" filename in |
|||
let ic, oc = Unix.open_process cmd in |
|||
let img = read_ppm ~ic in |
|||
(img) |
|||
;;</lang> |
|||
=={{header|Tcl}}== |
=={{header|Tcl}}== |