Bitmap/PPM conversion through a pipe: Difference between revisions

(Added Kotlin)
Line 178:
 
=={{header|Mathematica}}==
The Windows command line does not like quotes in the middle of text, so strings have been turned into character codes.
{{untested|Mathematica}}
<lang Mathematica>convert[img_image_, out_] := Module[{process=StartProcess[{
StartProcess[{"WolframKernelwolfram", "-noinit", "-noprompt", "-run",
Module[{pipe =
"Export[FromCharacterCode["~~ToString[ToCharacterCode[out]]~~"],ImportString[StringRiffle[Table[InputString[],{4}],FromCharacterCode[10]],FromCharacterCode[{80,80,77}]]]"
StartProcess[{"WolframKernel", "-noinit", "-noprompt", "-run",
}]},
"Export[\"out.jpg\",ImportString[InputString[],\"PPM\"]]"}]},
WriteLine[process,image];
WriteString[pipe, ExportString[Image[Graphics[]], "PPM"]];
WriteLine[process,"Quit[]"];
Close[pipe];];</lang>
];</lang>
 
== {{Header|OCaml}} ==
Anonymous user