RosettaCodeData/Task/Bitmap-Read-an-image-through-a-pipe/Nim/bitmap-read-an-image-through-a-pipe.nim
2023-07-01 13:44:08 -04:00

12 lines
339 B
Nim

import bitmap
import osproc
import ppm_read
import streams
# Launch Netpbm "jpegtopnm".
# Input is taken from "input.jpeg" and result sent to stdout.
let p = startProcess("jpegtopnm", args = ["input.jpeg"], options = {poUsePath})
let stream = FileStream(p.outputStream())
let image = stream.readPPM()
echo image.w, " ", image.h
p.close()