Bitmap/PPM conversion through a pipe: Difference between revisions
Content added Content deleted
(Added Kotlin) |
|||
Line 178: | Line 178: | ||
=={{header|Mathematica}}== |
=={{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[ |
<lang Mathematica>convert[image_,out_]:=Module[{process=StartProcess[{ |
||
⚫ | |||
Module[{pipe = |
|||
"Export[FromCharacterCode["~~ToString[ToCharacterCode[out]]~~"],ImportString[StringRiffle[Table[InputString[],{4}],FromCharacterCode[10]],FromCharacterCode[{80,80,77}]]]" |
|||
⚫ | |||
}]}, |
|||
"Export[\"out.jpg\",ImportString[InputString[],\"PPM\"]]"}]}, |
|||
WriteLine[process,image]; |
|||
WriteString[pipe, ExportString[Image[Graphics[]], "PPM"]]; |
|||
WriteLine[process,"Quit[]"]; |
|||
Close[pipe];];</lang> |
|||
];</lang> |
|||
== {{Header|OCaml}} == |
== {{Header|OCaml}} == |