Bitmap/Read an image through a pipe: Difference between revisions
→{{header|Go}}: Integrate with flood fill task. (The previous rev was still working fine)
(Added Mathematica) |
(→{{header|Go}}: Integrate with flood fill task. (The previous rev was still working fine)) |
||
Line 105:
=={{header|Go}}==
This example uses convert to convert the test image for the flood fill task. It reads through the pipe as required for this task, then writes as a .ppm file convenient for the flood fill task.
<lang go>package main
Line 115 ⟶ 114:
import (
"
"os/exec"
"raster"
Line 121 ⟶ 120:
func main() {
c := exec.Command("convert", "Unfilledcirc.png", "-depth", "8", "ppm:-")
pipe, err := c.StdoutPipe()
if err != nil {
}
if err = c.Start(); err != nil {
}
b, err := raster.ReadPpmFrom(pipe)
if err != nil {
}
if err = b.WritePpmFile("
}
}</lang>
|